com.google.android.gms:play-services-gcm:8.4.0会导致错误 [英] com.google.android.gms:play-services-gcm:8.4.0 leads to error

查看:560
本文介绍了com.google.android.gms:play-services-gcm:8.4.0会导致错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我使用了以下版本的GCM库。

  compile'c​​om.google.android.gms: play-services-gcm:7.8.0'

现在我将它更新到以下版本 p>

  compile'c​​om.google.android.gms:play-services-gcm:8.4.0'

但是我收到以下错误消息。

  02-05 23:51:29.205 18410-18410 / com.example.app E / GMPM:GoogleService初始化失败,状态:10,缺少预期资源:'R.string.google_app_id'用于初始化Google服务。可能的原因是缺少google-services.json或com.google.gms.google服务gradle插件。 
02-05 23:51:29.205 18410-18410 / com.example.app E / GMPM:调度程序未设置。不记录错误/警告。
02-05 23:51:29.238 18410-18452 / com.example.app E / GMPM:无法上传。应用测量被禁用

请帮我解决这个问题。



我也使用以下配置项目:

  apply plugin:'com.google.gms.google-服务'

 依赖关系{
classpath'com.android.tools.build:gradle:1.5.0'
classpath'com.google.gms:google-services:1.3.0'


//注意:不要在这里放置您的应用程序依赖项;它们属于单个模块build.gradle文件中的
// //


解决方案

较新版本的GoogleServices需要一个JSON文件,其中包含有关您的应用和帐户的配置信息。 此处提供的说明



通过升级到最新的构建工具(截至2016年2月5日),您可能会看到更好的结果:

  buildToolsVersion23.0。 2

  classpath'com.android.tools.build:gradle:2.0.0-beta2'
classpath'com.google.gms:google-services:2.0.0-beta2'

这些新工具预计将google-services插件应用于构建的底部文件,如这个例子。 FWIW,我正在使用这些设置进行构建,但没有看到错误。



有关 google-services.json 文件此处提供


In my project I was using the following version of GCM library.

compile 'com.google.android.gms:play-services-gcm:7.8.0'

Now I update it in to the following version

compile 'com.google.android.gms:play-services-gcm:8.4.0'

But I am getting the following error.

02-05 23:51:29.205 18410-18410/com.example.app E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services.  Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.
02-05 23:51:29.205 18410-18410/com.example.app E/GMPM: Scheduler not set. Not logging error/warn.
02-05 23:51:29.238 18410-18452/com.example.app E/GMPM: Uploading is not possible. App measurement disabled

Please help me to solve this issue.

I have configured my project with the following too

apply plugin: 'com.google.gms.google-services'

.

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


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

解决方案

Newer versions of GoogleServices require a JSON file that contains configuration information about your app and account.

Follow the instructions provided here.

You might also see better results by upgrading to the latest build tools (as of 5 Feb 2016):

buildToolsVersion "23.0.2"

and

classpath 'com.android.tools.build:gradle:2.0.0-beta2'
classpath 'com.google.gms:google-services:2.0.0-beta2'

The new tools expect the google-services plugin to be applied at the bottom of the build file, as shown in this example. FWIW, I'm building with these settings and not seeing the error.

Additional information about the google-services.json file, with troubleshooting tips, is provided here.

这篇关于com.google.android.gms:play-services-gcm:8.4.0会导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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