在项目文件的目录下的 settings.gradle.kts 中修改配置,配置中包含插件和依赖项
pluginManagement {
repositories {
maven { url=uri ("https://www.jitpack.io")}
maven { url=uri ("https://maven.aliyun.com/repository/releases")}
maven { url=uri ("https://maven.aliyun.com/repository/google")}
maven { url=uri ("https://maven.aliyun.com/repository/central")}
maven { url=uri ("https://maven.aliyun.com/repository/gradle-plugin")}
maven { url=uri ("https://maven.aliyun.com/repository/public")}
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven { url=uri ("https://www.jitpack.io")}
maven { url=uri ("https://maven.aliyun.com/repository/releases")}
maven { url=uri ("https://maven.aliyun.com/repository/google")}
maven { url=uri ("https://maven.aliyun.com/repository/central")}
maven { url=uri ("https://maven.aliyun.com/repository/gradle-plugin")}
maven { url=uri ("https://maven.aliyun.com/repository/public")}
google()
mavenCentral()
}
}
rootProject.name = "My Application" # 这里的 My Application 是项目名称
include(":app")
-
打开项目文件下的 gradle → wrapper → gradle-wrapper.properties 修改镜像地址
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.9-bin.zip