// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是我得到的错误评估根项目“LuckyMuch”时出现问题。
Build was configured to prefer settings repositories over project repositories but repository 'Google' was added by build file 'build.gradle'
使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。
最佳答案
即使我遇到了这个问题,我也用下面的代码更新了 settings.gradle 文件,它对我有用
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "Chat App"
include ':app'
关于android - 在 build.gradle(project) 中添加存储库的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68747059/