運行項目的時候報了這個錯誤:
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.lxweimin.com/p/47bf8941c0ac
來源:簡書
著作權歸作者所有。商業轉載請聯系作者獲得授權,非商業轉載請注明出處。