我的android studio版本是3.0
在builde.gradle中添加依赖的时候出现了如下的异常情况:
Error:FAILURE: Build failed with an exception. * What went wrong: 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-compiler-8.8.1.jar (com.jakewharton:butterknife-compiler:8.8.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. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 3s
下面是正确的修改方法:只需要添加部分代码即可
android{
……
defaultconfig{
……
<--添加部分-->
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
}