Android Studio 3中解决butterknife:7报错的问题

Android Studio 3中解决butterknife:7报错的问题

最近从GitHub上Fork了一个项目任阅,用Android Studio3 打开后
Android Studio 3.0中android-apt切换为官方annotationProcessor
解决apt的问题后butterknife又有问题。

报错:

1
2
3
4
5
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-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.

解决办法:
加上 annotationProcessor ‘com.jakewharton:butterknife:7.0.1’即可解决

1
2
   compile 'com.jakewharton:butterknife:7.0.1'
+ annotationProcessor 'com.jakewharton:butterknife:7.0.1'

参考:https://www.jianshu.com/p/09dc882a9fad

Fork me on GitHub