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

根据网络的解决方法是:

一、把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.
    - 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

}

}

}

猜你喜欢

转载自blog.csdn.net/NCTU_to_prove_safety/article/details/87922735
今日推荐