I have just updated to Android Studio 4.0 and trying to build my project. I keep on getting the below error
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.
I am already using the latest version of Gradle and Gradle Plugin
Gradle version:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-milestone-1-all.zip
Gradle plugin tools version:
classpath 'com.android.tools.build:gradle:4.1.0-alpha10'
Any solution or fix for this problem would be helpful. Thanks in advance.
Use Android studio 4.1 preview or classpath 'com.android.tools.build:gradle:4.0.0'
This is usually due to a mismatch between your Android Studio versions and the Android Gradle plugin.
You can find the version of Android Studio on the project selection window when you first open it (or in "Android Studio > About Android Studio" on Mac, and similar location on other platforms). For example, you might be using Android Studio 4.0.1.
You can find the Android Gradle plugin version for your project in the top-level build.gradle
file.
You should find something like the following:
buildscript {
[...]
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
[...]
}
[...]
}
You need to make sure that the two version numbers match (in this case they do).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With