Android Studio Warning: Using incompatible plugins for the annotation processing

AndroidAndroid StudioWarnings

Android Problem Overview


After update Android Studio to 2.3 version I have warning:

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

Any solutions? My app stopped working...

Android Solutions


Solution 1 - Android

Your app level gradle dependencies should include (as per butterknife website instructions):

compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

You can remove the line :

apply plugin: 'com.neenbedankt.android-apt'

Annotation Processing became available in Android Gradle plugin (2.2 and later) so there is now no need to use the above plugin anymore if using this version of gradle or greater.

If you'd like to know how to turn annotation processing off and on and AS the setting is in :

Settings > Build, Execution, Deployment > Compiler > Annotation Processors

Solution 2 - Android

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'

Solution 3 - Android

To add to @Milan's answer, if you used the hotchemi permissiondispatcher library in your app level gradle file then you should replace it as follows:

Replace

apt 'com.github.hotchemi:permissionsdispatcher-processor:2.4.0'

with

annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.4.0'

Solution 4 - Android

At Project Gradle buildscript --> dependencies block, remove the second classpath line :

dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
    // classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

And at app Gradle dependencies block, change these lines, use api and annotationProcessor :

api 'com.google.dagger:dagger:2.19'
annotationProcessor 'com.google.dagger:dagger-compiler:2.19'

Also, remove this one:

//apply plugin: 'com.neenbedankt.android-apt'

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionK. KempskiView Question on Stackoverflow
Solution 1 - AndroidMarkView Answer on Stackoverflow
Solution 2 - AndroidMilan HlinákView Answer on Stackoverflow
Solution 3 - AndroidAkinola OlayinkaView Answer on Stackoverflow
Solution 4 - AndroidHossein KurdView Answer on Stackoverflow