Android Studio:Gradle 项目同步失败。基本功能将无法正常工作

Android Studio:Gradle project sync failed. basic functionality will not work properly

我已经使用了 VPN 和 try it again 但仍然无法正常工作。
如果我直接访问该网站,就可以了。请参阅下面的堆栈跟踪:

将此代理信息添加到您的 gradle.properties 文件中:

systemProp.https.proxyPort=9595
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=9595

并在您的 vpn 中设置上述代理端口(例如 9595),例如 psiphone。然后同步项目。

并像这样将 mavenCentral() 添加到您的 build.gradle 项目中:

buildscript {
    repositories {

        google()
        jcenter()
        mavenCentral()
        maven {
            name 'Sonatype SNAPSHOTs'
            url 'https://oss.sonatype.org/content/repositories/snapshots/'
        }


    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'

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

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        google()

        maven { url 'https://jitpack.io' }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        flatDir {
            dirs 'libs'
        }
    }
}

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

看到这个post