我刚刚更新到Android Studio 4.0,正在尝试构建我的项目。我一直收到下面的错误
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.
我已经在使用最新版本的Gradle和Gradle插件
Gradle版本:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-milestone-1-all.zip
Gradle插件工具版本:
classpath 'com.android.tools.build:gradle:4.1.0-alpha10'
对这个问题的任何解决方案或修复都是有帮助的。提前谢谢。
发布于 2020-06-07 00:59:07
使用Android studio 4.1预览或classpath 'com.android.tools.build:gradle:4.0.0‘
发布于 2020-08-28 15:24:39
这通常是因为你的Android Studio版本和Android Gradle插件不匹配。
第一次打开Android Studio时,您可以在项目选择窗口中找到Android Studio的版本(或者在Mac上的"Android Studio> About Android Studio“中,在其他平台上也可以找到类似的位置)。例如,您可能正在使用Android Studio 4.0.1。
您可以在顶级build.gradle
文件中找到适用于您的项目的Android Gradle插件版本。
您应该会找到类似以下内容的内容:
buildscript {
[...]
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
[...]
}
[...]
}
您需要确保两个版本号匹配(在本例中是匹配的)。
https://stackoverflow.com/questions/62233809
复制相似问题