Android studio 引入butterknife使用时:
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-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中,添加如下配置就OK了
android {
...
defaultConfig {
...
javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
}
...
}
解决ButterKnife集成错误
本文介绍了解决在Android Studio中集成ButterKnife时遇到的特定错误的方法。通过修改app的build.gradle文件中的配置,可以有效地解决注解处理器声明的问题。
1万+

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



