5

I was building my android project on Android Studio 4.2.1. but I get this error:

org.gradle.tooling.model.UnsupportedMethodException: Unsupported method: 
    AndroidArtifact.getBuildConfigFields().
    The version of Gradle you connect to does not support that method.
    To resolve the problem you can change/upgrade the target version of Gradle you connect to.
    Alternatively, you can ignore this exception and read other information from the model.

my Gradle version:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip

my Gradle plugin tools version:

com.android.tools.build:gradle:4.1.0-alpha09

The both Gradle and Gradle plugin are the latest versions. The exception says that I need to update/change the connected Gradle version.

I am impossible to upgrade further version because I am already on the latest version. So, the only thing I can do is changing the grade version, but which one?

2
  • 2
    It looks like a bug in either Gradle and/or the Android Gradle Plugin. There is a bug open in the Google issue tracker: issuetracker.google.com/issues/155936233. It looks like upgrading to Android Studio Canary 9 fixes it.
    – mbonnin
    May 24, 2020 at 10:01
  • Downgrade its version to 4.0.1 Jul 28, 2020 at 20:27

1 Answer 1

1

I was able to build project successfully by using :

classpath 'com.android.tools.build:gradle:4.0.0'

But if you are trying to use jetpack compose you will have to use latest canary version of android studio.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.