连接超时添加镜像:Connect to repo.maven.apache.org:443 [repo.maven.apache.org/] failed: Connection timed

张开发
2026/6/9 22:21:58 15 分钟阅读
连接超时添加镜像:Connect to repo.maven.apache.org:443 [repo.maven.apache.org/] failed: Connection timed
目录1. 在gradle-wrapper.properties下添加2.老版AndroidStudio: 到build.gradle文件下添加3.新版AndroidStudio3.1到setting.gradle添加3.2另一种添加镜像方式: 项目下的build.gradle添加原因:可能是连接超时,导致下载失败,添加镜像即可1. 在gradle-wrapper.properties下添加//例如 https://mirrors.aliyun.com/macports/distfiles/gradle/gradle-8.7-bin.zip2.老版AndroidStudio: 到build.gradle文件下添加// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() mavenCentral() maven { url https://maven.aliyun.com/repository/gradle-plugin } } dependencies { classpath com.android.tools.build:gradle:4.2.2 // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() mavenCentral() jcenter() // Warning: this repository is going to shut down soon maven { url https://maven.aliyun.com/repository/gradle-plugin } } } task clean(type: Delete) { delete rootProject.buildDir }//或者 buildscript { repositories { maven { url https://maven.aliyun.com/repository/jcenter } } } allprojects { repositories { maven { url https://maven.aliyun.com/repository/jcenter } } }3.新版AndroidStudio3.1到setting.gradle添加maven { url https://jitpack.io } maven { url https://maven.aliyun.com/repository/public } maven { url https://maven.aliyun.com/repository/central } maven { url https://maven.aliyun.com/repository/google } maven { url https://maven.aliyun.com/repository/gradle-plugin }3.2另一种添加镜像方式: 项目下的build.gradle添加maven { url https://maven.aliyun.com/repository/jcenter }例如:

更多文章