Android Studio3.0报错:Annotation processors must be explicitly declared now

偶尔在GitHub上搞点代码瞅瞅,AS升级3.0之后带入经常吃点这样那样的错误:

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 (com.jakewharton:butterknife:7.0.1)
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 {
        ...
        //添加如下配置

       javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
    }
}
 

猜你喜欢

转载自blog.csdn.net/Android_hv/article/details/83992423