运行项目的时候报了这个错误:
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-6.1.0.jar (com.jakewharton:butterknife:6.1.0)
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.
原因:
使用注解编译库,需要显示的声明,而我正在使用的butterknife是含有注解编译功能的,但是我的没有声明,所以导致变异错误。
解决办法:
android {
defaultConfig {
// 声明需要使用注解功能
javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
...
}
}
作者:珠穆朗玛小王子
链接:http://www.jianshu.com/p/47bf8941c0ac
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。