android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor'

野性酷女 2022-03-16 00:40 306阅读 0赞

根据网络的解决方法是:

一、把project目录下的build.gradle中的classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.8’删除掉;

二、把具体Module目录下的build.gradle中的apply plugin: ‘com.neenbedankt.android-apt’删除;

三、同时把dependencies中原来使用apt的改为annotationProcessor,然后Sync Now即可。

我在外部的build.gradle中的classpath’com.neenbedankt.gradle.plugins:android-apt:1.8’注释了,但是在内部build.gradle找不到apply plugin: ‘com.neenbedankt.android-apt’,同样dependencies中也没有apt

解决方法是:

在内部的build.gradle的顶部删除 applyplugin:’android-apt’会出来一个更新 点击更新,外部的classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.8’都不用修改 ,就完成了。

弄完了之后还是 报错

Error:Execution failed for task ‘:app:javaPreCompileDebug’.

Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.

  1. - butterknife-compiler-8.6.0.jar (com.jakewharton:butterknife-compiler:8.6.0)

Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and will be removed in the future.
See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.

解决办法:

android{

defaultConfig{

….

javaCompileOptions {

annotationProcessorOptions {

includeCompileClasspath true

}

}

}

发表评论

表情:
评论列表 (有 0 条评论,306人围观)

还没有评论,来说两句吧...

相关阅读