Setting Explict Annotation Processor Setting Explict Annotation Processor android android

Setting Explict Annotation Processor


To fix the error, simply change the configuration of those dependencies to use annotationProcessor. If a dependency includes components that also need to be on the compile classpath, declare that dependency a second time and use the compile dependency configuration.

For example:

annotationProcessor 'com.jakewharton:butterknife:7.0.1'compile 'com.jakewharton:butterknife:7.0.1'

This link describes it in detail: https://developer.android.com/studio/preview/features/new-android-plugin-migration.html#annotationProcessor_config

Relevant snippet included for completeness.

Use the annotation processor dependency configuration

In previous versions of the Android plugin for Gradle, dependencies on the compile classpath were automatically added to the processor classpath. That is, you could add an annotation processor to the compile classpath and it would work as expected. However, this causes a significant impact to performance by adding a large number of unnecessary dependencies to the processor.

When using the new plugin, annotation processors must be added to the processor classpath using the annotationProcessor dependency configuration, as shown below:

dependencies { ... annotationProcessor 'com.google.dagger:dagger-compiler:' }

The plugin assumes a dependency is an annotation processor if its JAR file contains the following file: META- INF/services/javax.annotation.processing.Processor. If the plugin detects annotation processors on the compile classpath, your build fails and you get an error message that lists each annotation processor on the compile classpath. To fix the error, simply change the configuration of those dependencies to use annotationProcessor. If a dependency includes components that also need to be on the compile classpath, declare that dependency a second time and use the compile dependency configuration.


I was with a similar error. I follow the instructions on the Google link and it works.

try to add the follow instructions to your app gradle file:

defaultConfig {    applicationId "com.yourdomain.yourapp"    minSdkVersion 17    targetSdkVersion 25    versionCode 1    versionName "1.0"    javaCompileOptions {        annotationProcessorOptions {            includeCompileClasspath = false        }    }}

Attention to -> includeCompileClasspath false


Add this code to your gradle app

defaultConfig{    javaCompileOptions {        annotationProcessorOptions {            includeCompileClasspath true        }    }}

I found the solution here https://github.com/JakeWharton/butterknife/issues/908