androidandroid-studiolombokannotation-processingandroid-studio-2.4

Android Studio 2.4 + Lombok annotationProcessor configuration confusion


I using lombok on some project, and with the new Android Studio 2.4 Update now (Preview) I get this strange error:

What went wrong: Execution failed for task ':core:javaPreCompileRelease'. Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration. - lombok-1.16.16.jar Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated 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 further information but with no luck, anyone of you possibly? https://developer.android.com/studio/preview/features/index.html?utm_source=android-studio#annotationProcessor_config


Solution

  • Update:

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

    Just worked perfectly, but I have two Android Studio modules, and two build.gradle files. The error log just changed a bit (module prefix), and I thought the fix didn't work.

    But after applying the fix to both build.gradle files everything worked perfectly.