Alexandr
Alexandr

Reputation: 121

After update AGP to 4.2.2 from 4.1.3 - get error "Execution failed for task ':app:lintVitalProductionRelease' "

besides AGP update, updated compileSdkVersion and targetSdkVersion to 30.

build success, if set

lintOptions {
    checkReleaseBuilds false
}

else i get

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 targetSdkVersion 30 gradle 7.0.2

Any idea, guys?

Upvotes: 9

Views: 2359

Answers (1)

haoxiqiang
haoxiqiang

Reputation: 567

It may be AGP bug. https://issuetracker.google.com/issues/226095015

At Oct 9, 2021:

I solved the same problem by change the configure:

gradle.properties

#org.gradle.configureondemand=true

After Nov 4, 2021:

you can upgrade AGP to the latest version e.g. 7.3.x. it won't happen.

April 12, 2023:

I found a new solution. edit the settings file at ~/.android/analytics.settings

- {"userId":"・・・・","hasOptedIn":true,"・・・・
+ {"userId":"・・・・","hasOptedIn":false,"・・・・ 

change hasOptedIn from true to false.

before gradle task execute, you should stop gradle by

./gradlew --stop

found by this link.

Upvotes: 24

Related Questions