欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Android Studio错误日志-注解报错Annotation processors must be explicitly declared now.

程序员文章站 2022-04-10 15:03:21
导入项目时,发现之前项目的butter knife报错,用到注解的应该都会报错Error:Execution failed for task ':app:javaPreCompileDebug'.> Annotation processors must be explicitly declared ......

导入项目时,发现之前项目的butter knife报错,用到注解的应该都会报错
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.
- butterknife-7.0.1.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.

在app的build中
android {
...
defaultconfig {
...
//添加如下配置就ok了
javacompileoptions { annotationprocessoroptions { includecompileclasspath = true } }
}
...
}