For those who have the same problem using Android Studio 2.4+ its not solved by doing any hints above except Janis Peisenieks answer.
Open your Intellij IDEA 2017 / Android Studio 2.4+ and go to (Windows)
- File->Other Settings->Default Settings
- Expand Build, Execution, Deployment
- Expand Compiler and choose Annotation Processors
- Make sure you have Enable annotation processing and "Obtain processors from project classpath" enabled
Last but not least update your projects build.gradle file with the snippet below. Ignore the hint that its deprecated, since it's not using (until now. See issue).
defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}
}
Found out that there is a very simple way doing this without all those changes above!
If you set your processor in the gradle like lombok you wont use only provided or testCompile. You need to add this using annotationProcessor aswell into your dependencies. Example:
dependencies {
provided "org.projectlombok:lombok:1.16.16"
annotationProcessor "org.projectlombok:lombok:1.16.16"
}
Thank you to Jack Wharton for butterknife where i figured out how he solved it.
Hint: You may need to invalidate cache and restart to get it working for some annotation processors like lombok.