最佳答案
将此代理信息添加到您的gradle.properties文件中:
systemProp.https.proxyPort=9595
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=9595
并在psiphone之类的vpn中设置高于代理端口(例如9595)。然后同步项目。
然后将
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。
关于android - Android Studio:Gradle项目同步失败。基本功能将无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55014902/