版本信息
Android Studio Arctic Fox | 2020.3.1
distributionUrl=https://services.gradle.org/distributions/gradle-7.0.2-bin.zip
classpath "com.android.tools.build:gradle:7.0.0"
无法下载第三方仓库,报错信息为
A problem occurred evaluating root project 'TestProject'.
> Build was configured to prefer settings repositories over project
repositories but repository 'maven4' was added by build file 'build.gradle'
解决方案
修改setting.gradle
中的dependencyResolutionManagement
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
// 新增
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "EasyWebVideo"
include ':app'
其他
还有种说法是把dependencyResolutionManagement
整段删除,还是跟以前一样修改build.gradle
,未尝试。
网友评论