Android Studio 2.4 + Lombok annotation Confusion configuration processor

I am using lombok in some project, and now with the new update of Android Studio 2.4 (Preview) I get this strange error:

What went wrong: execution completed for task ': Kernel: javaPreCompileRelease. Annotation handlers must be explicitly declared now. The following classpath compilation dependencies are found to contain an annotation handler. Add them to the processor annotation configuration. - lombok-1.16.16.jar Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue the previous behavior. Please note that this option is outdated and will be removed in the future. See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.

I already tried:

annotationProcessor "org.projectlombok: lombok: 1.16.16"

but has no effect.

I also tested:

android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true

But also has no effect.

Also checked the support page for more information, but no luck, are any of you possible? https://developer.android.com/studio/preview/features/index.html?utm_source=android-studio#annotationProcessor_config

+5
source share
2 answers

Update:

provided "org.projectlombok:lombok:1.16.16" // keep annotationProcessor "org.projectlombok:lombok:1.16.16" // add this 

It just worked fine, but I have two Android Studio modules and two build.gradle files . The error log has changed a bit (module prefix), and I thought the fix was not working.

But after applying the fix to the files and build.gradle, everything worked fine.

+6
source

I had the same problem, but I need a slightly different fix (although the idea is taken from the accepted answer above - fooobar.com/questions/1267543 / ... )

It turned out that I already have the provided and annotationProcessor in the build.gradle files .. but I also had a compilation record. Removing this fix for me:

 compile 'org.projectlombok:lombok:1.16.16' // remove this provided 'org.projectlombok:lombok:1.16.16' annotationProcessor "org.projectlombok:lombok:1.16.16" 

I just thought I'd add my conclusions if that helps anyone. I use Android Studio 3.0 Canary 4 and gradle: 3.0.0-alpha4 in my endless quest to get build time down, which never pays off :)

+1
source

All Articles