我正在尝试在Android Studio的最新版本上构建这个旧的应用程序,该版本需要Gradle 1.10。我一直收到同步错误(见下文)。
SYNC ERROR:
Gradle sync failed: Unsupported method: SyncIssue.getMultiLineMessage().
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.
Consult IDE log for more details (Help | Show Log) (8 s 599 ms)
我应该在标有*的行中包含哪些版本/编号。
buildscript {
repositories {
mavenCentral()
}
dependencies {
**** classpath 'com.android.tools.build:gradle:1.5.0'
}
}
apply plugin: 'android'
repositories {
mavenLocal()
mavenCentral()
}
android {
*** compileSdkVersion 19
*** buildToolsVersion "19.1"
defaultConfig {
*** minSdkVersion 10
*** targetSdkVersion 19
}
lintOptions {
abortOnError false
}
}
dependencies {
*** compile 'com.android.support:appcompat-v7:19.1.0'
*** compile 'com.bitalino:bitalino-java-sdk:1.0'
*** compile 'org.roboguice:roboguice:3.0b-experimental'
*** compile 'com.squareup.retrofit:retrofit:1.5.0'
}
发布于 2020-10-20 05:38:26
当我试图导入我正在选修的类的文件时,我一直收到这个错误。经过几天的挖掘,幸运的是,我了解了gradle版本和Android Gradle插件版本。这些数字并不相同,但它们必须与此链接中的表相对应:https://developer.android.com/studio/releases/gradle-plugin在我获得它之后,我必须进入build.gradle文件并将其更改为以下内容。我的更改已添加注释
// Top-level build file where you can add configuration options common to all sub-
projects/modules.
buildscript {
repositories {
google()//Add this
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'//change to this
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()//add this
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
并在griddle-wrappers.properties文件中更改
distributionUrl=https://services.gradle.org/distributions/gradle-2.10-all.zip
至
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-all.zip
如果您查看链接中的表格,您将看到此build.gradle文件中的4.1.0行
classpath 'com.android.tools.build:gradle:4.1.0'
匹配gradle-wrapper.properties行中的6.5-all
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-all.zip
我没有试过,但我可以想象,只要图表上的数字彼此对应,即使不完全是这些数字,它也会起作用。
希望这能帮到你。
发布于 2020-10-18 10:20:50
尝试将Android Gradle插件更新为最新的可用版本:
变化
classpath 'com.android.tools.build:gradle:1.5.0'
至
classpath 'com.android.tools.build:gradle:2.3.2'
发布于 2020-11-14 12:50:28
是的,确实--但是IDE似乎不知道最新的版本。当我遇到这种类型的错误时,我会使用最新版本,但IDE会创建一条无用的错误消息。我们知道房子着火了,你想知道如何扑灭它……
https://stackoverflow.com/questions/64409047
复制相似问题