前言
Android Studio ERROR: Read timed out
在settings.gradle添加阿里云仓库
具体操作
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
pluginManagement {
repositories {
google()
mavenCentral()
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
}
}
rootProject.name = "My Application"
include ':app'
如何加载
最后一步,点击上面的绿色小锤子或者Build加载一下就可以了。加载过程需要很久,我加载了大约一个小时左右,需要耐心等待加载完成。
总结
Androidstudio的版本默认是用的mavenCentral()的库,但是它是外国仓库镜像,所以有时候我们会出现读取超时的情况,这时我们需要添加国内阿里云maven仓库镜像,进行重新加载(加载时间很长,本人加载一个多小时)
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }