國內因為GFW的原因,導致同步谷歌等服務器的插件源非常非常慢,幾乎是龜爬,還好有阿里雲的鏡像源,據說速度很快,還不快試試:
1、build.gradle里的buildscript和allprojects添加阿里鏡像
repositories {
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
}
詳細配置示例如下:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" } }
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" } }
}
task clean(type: Delete) {
delete rootProject.buildDir
}
2、setting里HTTP proxy里設置HTTP代理:
大連東軟信息學院鏡像服務器地址:
- http://mirrors.neusoft.edu.cn 端口:80
北京化工大學鏡像服務器地址:
- IPv4: http://ubuntu.buct.edu.cn/ 端口:80
- IPv4: http://ubuntu.buct.cn/ 端口:80
- IPv6: http://ubuntu.buct6.edu.cn/ 端口:80
上海GDG鏡像服務器地址:
- http://sdk.gdgshanghai.com 端口:8000
補充:
然后,再記錄幾個 Android SDK update sites:
1.mirrors.neusoft.edu.cn //東軟信息學院
2.ubuntu.buct.edu.cn/ubuntu.buct.cn //北京化工大學
3.mirrors.opencas.cn (mirrors.opencas.org/mirrors.opencas.ac.cn) //中國科學院開源協會
4.sdk.gdgshanghai.com 端口:8000 //上海GDG鏡像服務器
5.mirrors.dormforce.NET //(棟力無限)電子科技大學
其中,強烈推薦電子科技大學的鏡像源!
多個源倉庫地址如下:
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
maven { url 'http://maven.oschina.net/content/groups/public/' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url "http://maven.springframework.org/release" }
maven { url "http://maven.restlet.org" }
maven { url "http://mirrors.ibiblio.org/maven2" }
maven {
url "http://repo.baichuan-android.taobao.com/content/groups/BaichuanRepositories/"
}
maven { url 'https://maven.fabric.io/public' }
jcenter()
google()
}
用nexus搭建的maven私服,阿里雲的,那下載速度真是杠杠的;
配置很簡單,修改conf文件夾下的settings.xml文件,添加如下鏡像配置:
<mirrors> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors>