7

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?

Alexandr
  • 101
  • 2

1 Answers1

12

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.

TWiStErRob
  • 44,762
  • 26
  • 170
  • 254
haoxiqiang
  • 359
  • 2
  • 4