首页 > 解决方案 > Gradle 同步失败:在存储库容器上找不到参数 [] 的方法 google()

问题描述

这是该项目反复出现的问题。我尝试了几种不同的解决方案,但都没有奏效。包括更新 gradle-wrapper.properties 中的类路径版本和版本号。

Build.Gradle 文件:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0-alpha09'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

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

Gradle-Wrapper.properties 文件:

#Thu Jan 30 12:09:16 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-rc-1-all.zip

标签: androidandroid-studiogradlebuild.gradle

解决方案


推荐阅读