在Android的Firebase设置文档中似乎是一个错误... Link
文档说要将它添加到build.gradle:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.1.0' // google-services plugin
}
}
allprojects {
// ...
dependencies {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
这对我不起作用,我在Stackoverflow上找到了这个解决方案(在存储库中添加maven {...}而不是在依赖项中):
allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
问题是:为什么这样做以及Firebase官方文档如何出错? 感谢。
答案 0 :(得分:0)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
在项目级build.gradle中编写此代码。
答案 1 :(得分:0)