[英]Getting error when I am trying to connect my Android Studio to Firebase following the docs
Where Should I paste this?我应该把这个贴在哪里?
AS in docs it shows to paste this in Root-level (project-level) Gradle file (/build.gradle):如文档中所示,将其粘贴到根级(项目级)Gradle 文件 (/build.gradle) 中:
but this is showing error when I am trying to paste this.但是当我试图粘贴它时这显示错误。
allprojects {
repositories {
// Make sure that you have the following two repositories
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
}
Following the video given by Firebase website as I have noticed that many things have changed in Android studio so its hard for me to follow the video.跟随 Firebase 网站提供的视频,因为我注意到 Android 工作室中的许多事情都发生了变化,所以我很难跟随视频。
my build.gradle file has these我的 build.gradle 文件有这些
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "PUCabz"
include ':app'
WHere should I paste the "allprojects repositories" code我应该在哪里粘贴“allprojects repositories”代码
I resolved this issue by commenting out 'dependencyResolutionManagement' section which is present in the settings.gradle.我通过注释掉 settings.gradle 中存在的“dependencyResolutionManagement”部分解决了这个问题。
Go to Gradle Scripts -> settings.gradle -> comment out 'dependencyResolutionManagement' Go 到 Gradle 脚本 -> settings.gradle -> 注释掉 'dependencyResolutionManagement'
//dependencyResolutionManagement {
// repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
// repositories {
// google()
// mavenCentral()
// }
//}
Then paste the all project repository in Gradle Scripts -> build.gradle -> paste it below 'plugins' section然后将所有项目存储库粘贴到 Gradle 脚本 -> build.gradle -> 将其粘贴到“插件”部分下方
like this-像这样-
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
}
allprojects {
repositories {
// Make sure that you have the following two repositories
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.