Warning:Using incompatible plugins for the annotation processing: android-apt. This may result in an

来源:互联网 发布:js 弹出是否 对话框 编辑:程序博客网 时间:2024/06/03 14:22


1.删除 build.gradle 下面的 classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

2.删除 build.gradle 下面的 apply plugin: 'android-apt'

3.修改 apt 为 annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'              

                      annotationProcessor 'org.immutables:value:2.4.4'


https://stackoverflow.com/questions/42632662/android-studio-warning-using-incompatible-plugins-for-the-annotation-processing

27down vote

In my project I use, among other things, Butter Knife and Immutables. After adding Immutables I got the following warning

Warning:Using incompatible plugins for the annotation processing: android-apt. This may result in an unexpected behavior.

and ButterKnife stopped working.

My configuration was as follows:

build.gradle (Project: MyApplication)

buildscript {    repositories {        jcenter()    }    dependencies {        classpath 'com.android.tools.build:gradle:2.3.1'        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'    }}

build.gradle (Module: app)

apply plugin: 'com.android.application'apply plugin: 'android-apt'...dependencies {    ...    // Butter Knife    compile 'com.jakewharton:butterknife:8.5.1'    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'    // Immutables    apt 'org.immutables:value:2.4.4'    provided 'org.immutables:value:2.4.4'    provided 'org.immutables:builder:2.4.4'    provided 'org.immutables:gson:2.4.4'}

After changing

annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'

to

apt 'com.jakewharton:butterknife-compiler:8.5.1'

warning disappeared and everything works as it should.

UPDATE

As Mark said, an annotation processor was included in the Gradle version 2.2 , so there is no reason to provide an extra one.

So:

1) Remove the class path for the apt from the build.gradle (Project: MyApplication)

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

2) Remove the plug in from the build.gradle (Module: app)

apply plugin: 'android-apt'

3) Change the dependencies from apt to the new annotationProcessor

annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'annotationProcessor 'org.immutables:value:2.4.4'

阅读全文
0 0