网上下载了一个项目,compileSdkVersion太老,改成
minSdkVersion 16
targetSdkVersion 26
compile改成implementation,
项目的lib包里也改成implementation,
结果报错lib中gradle依赖的第三方都找不到,implementation改成api,然后报错
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'
然后在defaultConfig中添加
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}
还是报错,最后解决方式
在app中也添加上
implementation 'com.jakewharton:butterknife:7.0.1'
annotationProcessor 'com.jakewharton:butterknife:7.0.1'
问题解决