昨天升级了AndroidStudio3.0,gradle版本也升到了3.0,之前的老项目中ButterKnife不能用了,报错如下:
* Error:Execution failed for task ':neiquanlib: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 (butterknife-5.1.1.jar)
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
}
}
}
}
网友评论