Google just release Android Studio 4.2 stable. I updated my AS from 4.1 to 4.2. Now I am getting this error. It's showing error in data binding.

Caused by: java.util.ServiceConfigurationError: javax.annotation.processing.Processor: android.databinding.annotationprocessor.ProcessDataBinding Unable to get public no-arg constructor
        at kotlin.collections.CollectionsKt___CollectionsKt.toCollection(_Collections.kt:1200)
        at kotlin.collections.CollectionsKt___CollectionsKt.toMutableList(_Collections.kt:1233)
        at kotlin.collections.CollectionsKt___CollectionsKt.toList(_Collections.kt:1224)
        at org.jetbrains.kotlin.kapt3.base.ProcessorLoader.doLoadProcessors(ProcessorLoader.kt:80)
        at org.jetbrains.kotlin.kapt3.base.ProcessorLoader.loadProcessors(ProcessorLoader.kt:45)
        at org.jetbrains.kotlin.kapt3.base.Kapt.kapt(Kapt.kt:42)
        ... 28 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
        ... 34 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
        ... 34 more

推荐答案

Android Studio 4.2.0 and more now comes with Java 11.0.8 shipped and will use it by default which cases this error in deprecated libraries.

The solution is simple, you need to change it to java (JDK) 1.8 in the menu File > Project Structure > JDK Location

image

Notices that Android Studio lower than 4.2.0 comes with java 1.8 already

Kotlin相关问答推荐

在Webflux应用程序中通过kotlin协程启动fire and forget job

升级使用jOOQ Gradle插件生成代码失败

Kotlin中一个接口的实现问题

房间数据库操作中的协程取消

为什么Kotlin有次构造函数和init块?

如何将消费者放入 Kotlin 的 map 中?

mutableStateOf 和 mutableStateListOf 有什么区别?

Eclipse:无法安装 Kotlin 插件

Kotlin spring boot @RequestBody 验证未触发

如何在 Android 的 Fragment 中使用 setUserVisibleHint

Moshi:解析单个对象或对象列表(kotlin)

内联函数导致单元测试代码覆盖率报告出错

.indices 在 kotlin 中的含义是什么?

Kotlin - 当表达式返回函数类型

下拉通知面板时是否可以暂停Android中的任何视频(媒体播放器)应用程序?

Kotlin中的下划线名称是为什么保留的?

Android 上的 Kotlin:将map到list

生成Kotlin类图

Kotlin flatMap - map

Android room DAO 接口不适用于继承