From apt to annotationProcessor As of the Android Gradle Plugin Version 2.2, All functionality that was previously provided by Android-apt is now available in the Android plugin. Android Gradle 2.3 is actively blocking android-apt now in anticipation of upcoming changes to the Android Gradle plugin. This means that android-apt is officially obsolete 😉

Here are the steps to migrate:

Make sure you are on the Android Gradle 2.2 plugin or newer. Remove the Android-apt plugin from your build scripts Change all apt, androidTestApt and testApt dependencies to their new format: Dependencies {the compile ‘com. Google. Dagger: a dagger: 2.0’ annotationProcessor ‘com. Google. Dagger: a dagger – compiler: 2.0’} annotationProcessor replaces apt in this example.

Processor arguments The Android Gradle plugin also allows configuring of processor arguments, just like the apt {} configuration block in android-apt. Unlike the android-apt configuration block, the variant or project are not passed into this block.

Here’s an example configuration:

android { … defaultConfig { … javaCompileOptions { annotationProcessorOptions { className ‘com.example.MyProcessor’

    // Arguments are optional.
            arguments = [ foo : 'bar' ]
        }
    }
}
...
Copy the code

} More info The Android plugin annotation processor works with both javac and jack, unlike android-apt which only works with javac. For more info you can refer to the docs (scroll down a bit on that page).

Known issues If you encounter an issue after migrating it might be a bug in the Android Gradle plugin. Please report these bugs in in the Android bug tracker. You can still revert to android-apt if you are not using Jack in the mean time.

Current issues that I’m aware of:

Test configurations not added to model: https://code.google.com/p/android/issues/detail?id=224272 There’s no support annotation support in project using the Android Groovy plugin.