AS使用lombok注解报错:Annotation processors must be explicitly declared now. The following dependencies on

Posted 竹山一叶

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AS使用lombok注解报错:Annotation processors must be explicitly declared now. The following dependencies on 相关的知识,希望对你有一定的参考价值。

Rebuild时报错信息如下所示:

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.20.jar (org.projectlombok:lombok:1.16.20)
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.

 

在app的build中
android {
    ...
    defaultConfig {
        ...
        //添加如下配置就OK了
        javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
    }
    ...
}

 

以上是关于AS使用lombok注解报错:Annotation processors must be explicitly declared now. The following dependencies on 的主要内容,如果未能解决你的问题,请参考以下文章

学习注解和了解lombok的原理

[Java 开发利器Lombok] 常用注解演示

阿里插件检查 lombok报错---方法缺少 '@Override' 注解

Lombok 安装使用

Lombok Requires Annotation Processing: Do you want to enable annotation processors?

lombok系列