问题
I'm trying to build this old app on the newest version of Android Studio that requires Gradle 1.10. I keep getting sync errors (See below).
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)
What versions/numbers should I have in my lines that are marked with ***.
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'
}
回答1:
Kept getting this error when I tried to import a file for a class I'm taking. Several days of digging and a little luck later, learned about gradle versions and Android Gradle Plug in versions. The numbers are not the same but they must correspond as per the table in this link: https://developer.android.com/studio/releases/gradle-plugin After I got that then I had to go into the build.gradle file and change it to this. My changes are annotated
// 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
}
and in the griddle-wrappers.properties file change
distributionUrl=https://services.gradle.org/distributions/gradle-2.10-all.zip
to
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-all.zip
If you look at the table in the link you will see that the 4.1.0 in this build.gradle file line
classpath 'com.android.tools.build:gradle:4.1.0'
matches the 6.5-all in this gradle-wrapper.properties line
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-all.zip
I didn't try it but I would imagine that as long as the numbers correspond to each other on the chart then it would work even if it weren't exactly these numbers.
Hope this helps you out.
回答2:
Try updating the Android Gradle plugin to the latest available version:
Change
classpath 'com.android.tools.build:gradle:1.5.0'
to
classpath 'com.android.tools.build:gradle:2.3.2'
回答3:
Yes indeed - however the IDE does not seem to know the latest version. I go with the latest versions when I get this type of error but IDE creates an error message that is not useful. We know the house is on fire and ee want to how to put it out...
来源:https://stackoverflow.com/questions/64409047/gradle-sync-failed-unsupported-method-syncissue-getmultilinemessage-androi