Firebase没有连接,它显示了一个错误,比如无法解析Android应用程序模块的Gradle配置。解决分级构建问题和/或重新同步。
有些人说,为了删除我的应用程序gradle中的jcenter()..But,我没有看到任何项目库,这是我的应用程序built.gradle.
// 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
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}`
发布于 2021-08-12 00:52:02
在尝试使用gradle 7.0.2为"maven { url 'https://jitpack.io‘}“添加存储库时,我也遇到了同样的问题。
当我添加所有项目块时:-
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
我得到以下错误。
--一个评估根项目'PetShop列表‘的问题。
Build被配置为更喜欢设置存储库而不是项目存储库,但是存储库'Google‘是由构建文件'build.gradle’添加的。
原因是由于settings.gradle.中的dependencyResolutionManagement块。
要解决这个问题,只需转到"settings.gradle“文件注释整个块的‘依赖解决方案管理’。
然后reSync你的项目,它应该能工作。
在settings.gradle中像这样改变
import org.gradle.api.initialization.resolve.RepositoriesMode
dependencyResolutionManagement {
repositories {
google()
// notice here -------------------------
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
// notice here -------------------------
mavenCentral()
maven { url 'https://jitpack.io' }
jcenter() // Warning: this repository is going to shut down soon
}
}
rootProject.name = "My Application"
include ':app'
发布于 2021-12-05 00:36:03
转到setting.gradle
文件。然后添加maven { url 'https://jitpack.io' }
这一行。
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' }
}
}
https://stackoverflow.com/questions/68740655
复制