1.解决Gradle下载过慢问题
gradle-wrapper.properties 文件中 distributionUrl 选项
替换https\://services.gradle.org/distributions为https\://mirrors.cloud.tencent.com/gradle
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-7.3.3-bin.zip
更改后:
2.解决Gradle 依赖下载过慢问题
settings.gradle 文件中添加 maven 字段(格式要正确)
pluginManagement {
repositories {
// 使用阿里镜像源
maven {
allowInsecureProtocol = true
url = "https://maven.aliyun.com/repository/google"
}
maven {
allowInsecureProtocol = true
url = "https://maven.aliyun.com/repository/central"
}
maven {
allowInsecureProtocol = true
url = "https://maven.aliyun.com/repository/gradle-plugin"
}
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
// 使用阿里镜像源
maven {
allowInsecureProtocol = true
url = "https://maven.aliyun.com/repository/google"
}
maven {
allowInsecureProtocol = true
url = "https://maven.aliyun.com/repository/central"
}
google()
mavenCentral()
}
}
更改后: