Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org.gradle.tooling.model.UnsupportedMethodException: Unsupported method: AndroidArtifact.getBuildConfigFields()

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?

like image 673
David Avatar asked Nov 06 '22 07:11

David


1 Answers

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.

like image 98
Dhruv garg Avatar answered Nov 15 '22 06:11

Dhruv garg