Q:

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

I have use the VPN and try it again but still not working.
If I direct access the website, it's ok. Please see stacktrace at below:

A:

Add this proxy information to your gradle.properties file:
systemProp.https.proxyPort=9595
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=9595

and set above proxy port (ex. 9595) in your vpn like psiphone. Then sync project.
And add mavenCentral() to your build.gradle of project like this:
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
}

See this post.

