问题
I want use lombok in Android Studio 3.0
I get error
Error:Execution failed for task ':app:javaPreCompileDebug'.
> 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.18.jar (org.projectlombok:lombok:1.16.18)
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.
My gradle dependency
compileOnly "org.projectlombok:lombok:1.16.18"
回答1:
try
compile 'org.projectlombok:lombok:1.16.18' annotationProcessor "org.projectlombok:lombok:1.16.18"
You can disable the generation of javax.annotation.Generated
by putting the following line in a lombok.config
file in one of the top directories of your project:
lombok.addGeneratedAnnotation = false
See the configuration documentation for more information.
来源:https://stackoverflow.com/questions/47112106/errorexecution-failed-for-task-appjavaprecompiledebug-android-3-0-lombok