Error:Execution failed for task ':app:javaPreCompileDebug'. Android 3.0+ lombok

两盒软妹~` 提交于 2019-12-12 04:46:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!