除了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
伙计们,有什么想法吗?
可能是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