今天公司项目拉代码构建出错,如图:

报错信息是

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工具的版本,具体降到多少看本地代码。

最后修改:2020 年 07 月 22 日 02 : 13 PM
如果觉得我的文章对你有用,请随意赞赏