【发布时间】:2017-11-04 15:05:43
【问题描述】:
我想在 Android Studio 3.0 中使用 lombok
我收到错误
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.
我的 gradle 依赖
compileOnly "org.projectlombok:lombok:1.16.18"
【问题讨论】:
-
好的,你试过了吗:
compile 'org.projectlombok:lombok:1.16.18' annotationProcessor "org.projectlombok:lombok:1.16.18" -
是的。但我收到错误 - 错误:(19, 1) 错误: 包 javax.annotation 不存在
-
那么这应该可以工作:
compileOnly 'javax.annotation:javax.annotation-api:1.2' compileOnly "org.projectlombok:lombok:1.16.18" annotationProcessor "org.projectlombok:lombok:1.16.18"
标签: android gradle lombok android-studio-3.0