Android Studio Arctic Fox |2020.3.1
这是因为新版本的AS生成的项目的build.gradle
文件不会生成allprojects
闭包 如果手动添加会报以下错误。所以之前添加远程仓库依赖的方法将不适用。
Caused by: org.gradle.api.InvalidUserCodeException: Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'
正确添加远程依赖库位置在settings.gradle
文件中
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter()
// 在此处添加仓库
maven { url 'https://jitpack.io' }
}
详细的官方变更日志我并没有找到如果有找到的还请发一下。