在Android开发时,将Android Studio升级至3.0之后,使用ButterKnife 7.0.1版本时出现如下错误:
Error:Execution failed for task ':xxx: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 (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.gradle中添加如下代码:
android {
......
defaultConfig {
......
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}
}
......
}
由此便可解决如上异常错误。
本文介绍了如何解决Android Studio 3.0升级后使用ButterKnife 7.0.1版本时出现的错误。通过修改app的build.gradle文件中的配置,可以有效地解决该问题。
224

被折叠的 条评论
为什么被折叠?



