setting.gradle 文件修改如下:
pluginManagement {
repositories {
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
maven { url 'https://developer.huawei.com/repo/' }
maven { url "https://jitpack.io" }
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
maven { url 'https://developer.huawei.com/repo/' }
maven { url "https://jitpack.io" }
google()
mavenCentral()
}
}
rootProject.name = "My Application"
include ':app'
gradle-wrapper.properties文件修改如下:
https://services.gradle.org/distributions/改成https://mirrors.cloud.tencent.com/gradle/
設(shè)置代理settings->System Settings->HTTP Proxy
注意:如果出現(xiàn)連接錯(cuò)誤,就把代理刪掉个初,鏡像一般就可以解決了
國(guó)內(nèi)常用的代理服務(wù)器(注意:只需要域名即可)
1、東軟信息學(xué)院
http://mirrors.neusoft.edu.cn 端口:80
2美旧、北京化工大學(xué)
http://ubuntu.buct.edu.cn/ 端口:80
http://ubuntu.buct.cn/ 端口:80
http://ubuntu.buct6.edu.cn/ 端口:80
3、中國(guó)科學(xué)院開源協(xié)會(huì)
http://mirrors.opencas.cn 端口:80
http://mirrors.opencas.org 端口:80
http://mirrors.opencas.ac.cn 端口:80
4是嗜、上海GDG鏡像服務(wù)器
http://sdk.gdgshanghai.com 端口:8000
5笼才、電子科技大學(xué)
http://mirrors.dormforce.net 端口:80
6、騰訊 Bugly 鏡像
http://android-mirror.bugly.qq.com 端口:8080