今天公司项目拉代码构建出错,如图:
报错信息是
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.
- permissionsdispatcher-processor-3.3.1.jar (com.github.hotchemi.permissionsdispatcher:permissionsdispatcher-processor:3.3.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.
其实解决办法在报错信息里写出来了:set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior.
百度里千篇一律也都是这个解决方案大同小异,就是在module对应的gradle文件中添加这一句:
defaultConfig {
applicationId "com.xxx.xxx"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
//添加了javaCompileOptions
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}
}
然后sync
Google给出的解释是:
这个方法后面还跟了一句话:Note that this option is deprecated and will be removed in the future.,说不准哪天不能用了。
还有一种办法,给出现问题的三方加上annotationProcessor配置
去gradle-wrapper.properties
中或者按Ctrl+Shift+Alt+S,降低gradle工具的版本,具体降到多少看本地代码。
版权属于:Vergil Wu
本文链接:https://www.vergil.com.cn/288.html
转载时须注明出处及本声明