伟明部落格

新版Android Studio(Arctic Fox以后)添加依赖仓库

--发布于 2022-11-19 15:12:56

以前,在Android Studio Arctic Fox版本之前,我们是在build.gradleallprojects闭包里面添加依赖仓库路径的。如下:

allprojects {
  repositories {
    google()
    mavenCentral()
    jcenter() // Warning: this repository is going to shut down soon
  }
}

在Arctic Fox版本之后,我们要在settings.gradlerepositories闭包里面添加。如下:

dependencyResolutionManagement {
  repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
  repositories {
    google()
    mavenCentral()
    jcenter() // Warning: this repository is going to shut down soon
  }
}
rootProject.name = "My Application"
include ':app'
--更新于 2023-03-09 10:51:41