如何在Android中添加google-services.json? [英] How to add google-services.json in Android?

查看:1835
本文介绍了如何在Android中添加google-services.json?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误是:

模块根文件夹中缺少文件google-services.json.这 没有它,Google Quickstart插件将无法运行.

File google-services.json is missing from module root folder. The Google Quickstart Plugin cannot function without it.

推荐答案

上述问题已根据developer.google.com

Above asked question has been solved as according to documentation at developer.google.com https://developers.google.com/cloud-messaging/android/client#get-config

2018 GCM 已弃用,请使用

2018 Edit : GCM Deprecated, use FCM

文件google-services.json应该粘贴到app/目录中. 在这之后,当我使用gradle文件同步项目时,出现了意外的顶级异常错误.发生这种情况是因为:

The file google-services.json should be pasted in the app/ directory. After this is when I sync the project with gradle file the unexpected Top level exception error comes. This is occurring because:

具有项目级Gradle文件

Project-Level Gradle File having

dependencies {
    classpath 'com.android.tools.build:gradle:1.0.0'
    classpath 'com.google.gms:google-services:1.3.0-beta1'
}

和具有以下内容的应用级Gradle文件:

and App-Level Gradle File having:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.google.android.gms:play-services:7.5.0' // commenting this lineworks for me
}

最上面的一行在此和classpath 'com.google.gms:google-services:1.3.0-beta1'之间造成了冲突,因此,我对此进行评论,它可以正常工作,并且没有错误 模块根文件夹中缺少文件google-services.json.没有它,Google Quickstart插件将无法运行.

The top line is creating a conflict between this and classpath 'com.google.gms:google-services:1.3.0-beta1' So I make comment it now it works Fine and no error of File google-services.json is missing from module root folder. The Google Quickstart Plugin cannot function without it.

这篇关于如何在Android中添加google-services.json?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆