将 AGP 从 4.1.3 更新到 4.2.2 后 - 出现错误“任务 ':app:lintVitalProductionRelease' 执行失败”

问题描述 投票:0回答:1

除了AGP更新外,更新compileSdkVersion和targetSdkVersion为30.

构建成功,如果设置

lintOptions {
    checkReleaseBuilds false
}

否则我得到

Execution failed for task ‘:app:lintVitalProductionRelease’.
> Could not resolve all dependencies for configuration ‘:app:debugUnitTestRuntimeClasspath’.
   > A problem occurred configuring project ‘:core-testing’.
      > java.lang.IllegalStateException: Accessing GradleBuildProject.Builder through AnalyticsConfiguratorService is not allowed after AnalyticsService is created.

compileSdkVersion 30 buildToolsVersion '30.0.3' minSdkVersion 21 targetSdk版本 30 摇篮 7.0.2

伙计们,有什么想法吗?

android android-gradle-plugin lint android-lint
1个回答
-1
投票

可能是agp bug。 https://issuetracker.google.com/issues/226095015

2021 年 10 月 9 日:

我通过更改配置解决了同样的问题:

gradle.properties

#org.gradle.configureondemand=true

2021 年 11 月 4 日之后:

您可以将 AGP 升级到最新版本,例如7.3.x。它不会发生。

2023 年 4 月 12 日:

我找到了一个新的解决方案。 在

~/.android/analytics.settings

编辑设置文件
- {"userId":"・・・・","hasOptedIn":true,"・・・・
+ {"userId":"・・・・","hasOptedIn":false,"・・・・ 

hasOptedIn
true
更改为
false
.

在 gradle 任务执行之前,你应该停止 gradle by

./gradlew -stop

通过此链接找到。

© www.soinside.com 2019 - 2024. All rights reserved.