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/
设置代理settings->System Settings->HTTP Proxy
注意:如果出现连接错误,就把代理删掉,镜像一般就可以解决了
IQUE.png
国内常用的代理服务器(注意:只需要域名即可)
1、东软信息学院
http://mirrors.neusoft.edu.cn 端口:80
2、北京化工大学
http://ubuntu.buct.edu.cn/ 端口:80
http://ubuntu.buct.cn/ 端口:80
http://ubuntu.buct6.edu.cn/ 端口:80
3、中国科学院开源协会
http://mirrors.opencas.cn 端口:80
http://mirrors.opencas.org 端口:80
http://mirrors.opencas.ac.cn 端口:80
4、上海GDG镜像服务器
http://sdk.gdgshanghai.com 端口:8000
5、电子科技大学
http://mirrors.dormforce.net 端口:80
6、腾讯 Bugly 镜像
http://android-mirror.bugly.qq.com 端口:8080
网友评论