我正在将Firebase添加到Android文档中之后设置带有Firebase的android的第一个项目,并停留在解决它说的Google Play服务依赖项上
我也用谷歌搜索,但找不到任何有用的答案。
在项目中:Gradle
dependencies {
classpath 'com.android.tools.build:gradle:2.1.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
}
在App中:Gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.firebase:firebase-core:9.0.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
我有什么想念的吗?当我在stackoverflow上阅读我的答案时,我应该怎么做,但是它们都没有用
您已经正确设置了插件和依赖项,但是需要Firebase Console中的google-services.json
配置文件。
如果您尚未连接应用程序,请选择“将Firebase添加到您的Android应用程序”,输入程序包名称,然后点击添加应用程序。这应该下载文件。
如果您之前连接过,请单击左侧导航栏中的齿轮,选择“项目设置”,然后下载google-services.json
与您的项目关联的项目。
您需要下载此文件,并将其放在您的app
目录中(该应用程序旁边build.gradle
)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句