我正在使用 Gradle 构建一个 Android Studio 项目。我在我的一个模块中使用自动值,但由于某种原因,任何高于 1.5.3 的自动值版本都会导致编译失败。
我在 build.gradle 中对模块的依赖如下所示:
annotationProcessor 'com.google.auto.value:auto-value:1.5.3'
如果我只是将 1.5.3 更改为 1.6.5,构建时会出现以下错误(同步工作正常):
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.
- auto-value-1.5.3.jar (com.google.auto.value:auto-value:1.5.3)
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.
我什至尝试使用文档中推荐的说明:
api "com.google.auto.value:auto-value-annotations:1.6.2"
annotationProcessor "com.google.auto.value:auto-value:1.6.2"
任何线索在这里做什么?