版本信息:
android-studio-2024.1.2.12
gradle-8.7 & 使用groovy配置
项目配置:
修改settings.gradle文件,将阿里云镜像仓库添加到google{}和mavenCentral()上方,不要随意改变仓库位置,仓库列出顺序决定 Gradle 在这些仓库中搜索各个项目依赖项的顺序。
pluginManagement {
repositories {
// 添加阿里镜像
maven { url 'https://maven.aliyun.com/repository/public'}
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
// 添加阿里镜像
maven { url 'https://maven.aliyun.com/repository/public'}
maven { url 'https://maven.aliyun.com/repository/central' }
google()
mavenCentral()
}
}
rootProject.name = "My Application"
include ':app'
标签:aliyun,repository,url,gradle,maven,studio,https,Android,com
From: https://blog.csdn.net/m0_52497955/article/details/142471338