Could not find com.android.tools.build:gradle:5.6

穿精又带淫゛_ 提交于 2019-12-18 18:07:21

问题


I have a problem with my gradle, i have try many solution that i have found on stackoverflow and other documentation but it still doesn't work, please help me


回答1:


Don't confuse gradle with the Android Gradle plugin.

classpath 'com.android.tools.build:gradle:5.6'

It is the Android Gradle plugin and 5.6 doesn't exist.

Use the latest stable release:

classpath 'com.android.tools.build:gradle:3.5.0'

Check the release notes for other versions.

To change the gradle version, edit the file gradle/wrapper/gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

More info in official doc.




回答2:


There is currently no version 5.6 for the Gradle plugin version. The link below lists all the latest releases for the Gradle plugin versions on Google's Marvel repository.

https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google

I think what you mean is the distributionUrl version in your Gradle wrapper properties:

Go to your gradle-wrapper.properties file and complete as required:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-all.zip

Then your build.gradle file for the project will be as follows:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript
        {
    repositories
            {
        google()
        jcenter()
    }

    dependencies
            {
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'com.android.tools.build:gradle:3.4.2'
    }
}


allprojects {

    repositories {
        google()
        maven { url 'https://maven.google.com' }
        jcenter()
    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}


来源:https://stackoverflow.com/questions/57606996/could-not-find-com-android-tools-buildgradle5-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!