I\'m using Android Studio 2.2 Preview 7, and the Lombok plugin suddenly started saying:
Annotation processing seems to be disabled for the project X
, and provid
As of Android Studio v3.5 (august 2019) and prior, there wasn't setting for annotation processor. It is however sufficient to define in build.gradle in dependencies section :
dependencies {
...
compileOnly 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8'
...
}
If Android studio still complains about "Lombok Requires Annotation Processing", for me it was Lombok plugin reinstallation and "Invalidate Caches / Restart" that fixed the problem.
The Settings opened by clicking the notification are the Per Project
settings, and those are not what you need in this case.
To fix this, go to
File->Other Settings->Default Settings
Build, Execution, Deployment
Compiler
Annotation Processors
check Enable annotation processing
For complete reference - screenshot with appropriate settings screen:
First, I don't think removing your project from the welcome screen can have any effect. Just think about it, removing your project from "recent projects" on that screen does not re-create it, how could changing Default settings have any effect on an existing project?
To enable annotation processing in an existing project you don't need to delete anything. Go to YourAwesomeProject/.idea/compiler.xml
and make sure you have value "true" in following attribute: /project/annotationProcessing/profile@enabled
.
Like this:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
...
<annotationProcessing>
<profile default="true" name="Default" enabled="true"><!-- here -->
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
You might need to File -> Invalidate Caches / Restart
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)
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.