Android Studio 初始程序时sync出现connection reset
《转载》并 自己亲测有效的方法,应该可以解决大部分情况下的sync加载出错的问题
第一步,打开一个自己出现标题错误的程序
把 //google()
//jcenter()
改为
maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
buildscript {
repositories {
//google()
//jcenter()
maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
//google()
//jcenter()
}
}
点击图中标示部分(若是此时你刚打开的这个项目还在加载转圈,则点击上方File,选择Save ALL保存修改),然后等待即可