修改Gradle初始化配置,使用maven国内镜像
allprojects{
repositories {
def REPOSITORY_URL = 'http://maven.oschina.net/content/groups/public'
all { ArtifactRepository repo ->
def url = repo.url.toString()
if ((repo instanceof MavenArtifactRepository) && (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com'))) {
project.logger.lifecycle 'Repository ${repo.url} replaced by $REPOSITORY_URL .'
remove repo
}
}
maven {
url REPOSITORY_URL
}
}
}
将上面配置放到init.gradle文件,存储到USER_HOME/.gradle/目录。
重启Android studio。
http://www.yrom.net/blog/2015/02/07/change-gradle-maven-repo-url/