首页 > 解决方案 > 我无法将我的项目同步到 gradle,出现此错误“添加 google Maven 存储库并同步项目”

问题描述

我尝试在我的存储库中添加这些代码:

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

但即使是现在我也无法同步 gradle

标签: android-studiogradlerepositorybuild.gradle

解决方案


在项目的build.gradle中,修改如下:

buildscript {
repositories {
    maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} // <-- add
    //jcenter()
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}



allprojects {
repositories {
    google()
    maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} // <-- add
    //jcenter()
}
}

我希望这有帮助


推荐阅读