Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle sync failed: Unsupported method: SyncIssue.getMultiLineMessage(). (Android Studio)

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'
}
like image 527
12bio23 Avatar asked Oct 18 '20 02:10

12bio23


People also ask

Why did my Gradle sync fail?

SYNC ERROR: Gradle sync failed: Unsupported method: SyncIssue.getMultiLineMessage (). The version of Gradle you connect to does not support that method.

How to resolve this Gradle model error?

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)

Why is the online Gradle distribution not working?

We came across several cases where the online distribution was not working as expected and failed the Gradle sync. Another workaround to this issue is to download the Gradle distribution manually and make use of that. Follow the steps below: Download the latest version of Gradle from the official Gradle Release Website.

How to install Gradle on Android Studio?

After downloading, extract all the files to an accessible folder. Now launch Android Studio and go to File > Settings > Build, Execution, Deployment > Gradle. Now select the option of Local Gradle Distribution. Also, when in the Gradle home, point to the path where you just extracted the files.


1 Answers

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.

like image 187
diver1rn Avatar answered Sep 29 '22 12:09

diver1rn