Gradle may disable incremental compilation as the following annotation processors are not ......

本文介绍了解决Gradle在构建Android应用时遇到的编译错误的方法。具体问题为使用了不支持JDK 9+的依赖导致的NoClassDefFoundError异常。文章提供了调整JDK版本以解决此问题的有效方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

导入一个已有工程时build失败,gradle task ':app:compileDebugJavaWithJavac' failed,报错如下:

> Task :app:compileDebugJavaWithJavac FAILED
Gradle may disable incremental compilation as the following annotation processors are not incremental: databinding-compiler-3.4.0.jar
 (androidx.databinding:databinding-compiler:3.4.0).
Consider setting the experimental feature flag android.enableSeparateAnnotationProcessing=true in the gradle.properties file to run a
nnotation processing in a separate task and make compilation incremental.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> javax/xml/bind/JAXBException

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugJavaWithJavac'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java
:205)
......
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
        at org.gradle.api.internal.tasks.compile.AnnotationProcessingCompileTask.instantiateProcessor(AnnotationProcessingCompileTask
.java:137)
......

网上搜索该问题,在https://segmentfault.com/a/1190000020028624https://segmentfault.com/q/1010000020030377中找到了问题原因解决方法,问题原因是javax.xml.bind不在jdk 9+的默认类路径上,所以找不到这些类,降低使用的jdk版本就可以解决此问题。

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值