Clone wiki

android-apt / Migration

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 {
    compile ''
    annotationProcessor ''

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' ]

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: