Android3.0升级后出现ButterKnife失效报错的问题解决

Error:Execution failed for task ':reading_routine: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-5.1.1.jar (com.jakewharton:butterknife:5.1.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.gradle文件,在android中defalutConfig的闭包中加入如下配置即可:

javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath = true  
            }
        }

修改完是这样的:

...
android {
    ...
    defaultConfig {
        ...
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath = true  
            }
        }
    }
}

你可能感兴趣的:(android-开发,Android,Studio,Exception)