2018年9月18日 AndroidStudio終于更新到了3.2穩(wěn)定版掌腰,但是更新之后新建項(xiàng)目總是會(huì)失敗楷掉,設(shè)置代理作喘,重新清理各種操作基本上都嘗試遍了理疙,也沒起到作用晕城,花了六個(gè)小時(shí)泞坦,終于找到了解決方案,在project的build.gradle文件中添加如下內(nèi)容砖顷,了解AndroidStudio的看官應(yīng)該一眼就明白了:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/'
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/')) {
remove repo
}
}
}
maven {
url REPOSITORY_URL
}
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/'
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/')) {
remove repo
}
}
}
maven {
url REPOSITORY_URL
}
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
最后贰锁,特別鳴謝:https://blog.csdn.net/u013360850/article/details/60595210
阿里的倉(cāng)庫(kù)地址:http://maven.aliyun.com/nexus/content/groups/public/
OSChina的倉(cāng)庫(kù)地址:http://maven.oschina.net/content/groups/public/