Gradle同步失败:不支持的方法:SyncIssue.getMultiLineMessage().(Android Studio) [英] Gradle sync failed: Unsupported method: SyncIssue.getMultiLineMessage(). (Android Studio)

查看:580
本文介绍了Gradle同步失败:不支持的方法:SyncIssue.getMultiLineMessage().(Android Studio)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在需要Gradle 1.10的最新版本的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'
}

推荐答案

当我尝试导入我正在上课的文件时,出现此错误.经过几天的挖掘和一点运气,了解了gradle版本和Android Gradle Plugin版本.数字不同,但是必须按照此链接中的表格进行对应: https://developer.android.com/studio/releases/gradle-plugin 在我知道之后,我不得不进入build.gradle文件并将其更改为该文件.我的更改已添加批注

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
}

并在griddle-wrappers.properties文件中更改

and in the griddle-wrappers.properties file change

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

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'

与此gradle-wrapper.properties行中的6.5全部匹配

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.

希望这对您有所帮助.

这篇关于Gradle同步失败:不支持的方法:SyncIssue.getMultiLineMessage().(Android Studio)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆