配置对所有项目起效的项目环境
查看.gradle所在位置 :打开Android Studio -> File -> setting
文件夹中打开Gradle user home显示的路径,在.gradle文件夹中创建init.gradle文件,在init.gradle文件中输入以下配置内容
allprojects{
repositories {
def MY_ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
def MY_ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $MY_ALIYUN_REPOSITORY_URL."
remove repo
}
if (url.startsWith('https://jcenter.bintray.com/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $MY_ALIYUN_JCENTER_URL."
remove repo
}
}
}
maven {
url MY_ALIYUN_REPOSITORY_URL
url MY_ALIYUN_JCENTER_URL
}
}
}
文章来源:https://www.toymoban.com/news/detail-764270.html
重启Android Studio即可文章来源地址https://www.toymoban.com/news/detail-764270.html
到了这里,关于解决:Android Studio下载gradle速度慢的问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!