问题描述
错误是:
推荐答案
上述问题已根据developer.google.com https://developers.google.com/cloud-messaging/android/client#get-config
Above asked question has been solved as according to documentation at developer.google.com https://developers.google.com/cloud-messaging/android/client#get-config
文件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 ofFile google-services.json is missing from module root folder. The Google Quickstart Plugin cannot function without it.
这篇关于如何在Android中添加google-services.json?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!