一、报错信息
Gradle 'xxxx' project refresh failed Error
:Connection timed out: connect
二、解决方法
1、方法一
进入AndroidStudio终端Terminal输入以下命令,等待gradle下载依赖文件重新构建
gradlew tasks --all
2、方法二
使用gradle国内站点
腾讯云镜像 Gradle下载地址:https://mirrors.cloud.tencent.com/gradle/
阿里云镜像 Gradle下载地址:https://mirrors.aliyun.com/macports/distfiles/gradle/
阿里云镜像 Gradle下载地址:https://mirrors.aliyun.com/gradle/
替换gradle-warpper.propeties中的distributionUrl为上面的任意一个
3、方法三
在build.gradle中使用一下配置
repositories {
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/jcenter/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://repo.huaweicloud.com/repository/maven' }
maven { url 'https://mirrors.cloud.tencent.com/repository/maven' }
mavenCentral()
}