GoogleService无法初始化 [英] GoogleService failed to initialize

查看:132
本文介绍了GoogleService无法初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android应用程序中使用Google地图。我已经创建了密钥并在清单文件中添加了必要的权限。但很快我启动应用程序,我在调试器中收到了这条消息:

lockquote

GoogleService未能初始化,状态为10,缺少预期的
资源:'R.string.google_app_id'用于初始化Google服务。
可能的原因缺少google-services.json或
com.google.gms.google-services gradle插件。




我不知道什么是错的。地图工作正常,我可以使用它没有任何问题。我的gradle文件包含以下条目:


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


什么是抱怨和如何减轻它?

解决方案

您需要放置由 google-services.json ) / mobile / add?platform = androidrel =noreferrer> developer.google.com ,正如官方文档第二步中所述这里



这个过程很简单


  1. 您可以选择您的项目或创建一个新项目。
  2. 然后,在选择所需的服务后您可以生成配置文件。


    对于已迁移到Firebase项目的用户,到 Firebase Console ,选择您的项目并在设置下可以找到配置文件。


    然后如官方文档的步骤3中所引用 / b>
    $ b


    复制 google- services.json 您刚刚下载到您的Android的应用/或mobile /目录中的文件


$ b:b

PS:对于那些低调回答这个问题的人,请留下评论,说明你为什么拒绝投票。

I am using google Maps in my android application. I have created the key and added necessary permissions in manifest file. But soon I start the application I get this message in debugger:

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.

I am not sure whats wrong. The Map is working fine and I can use it without any issues. My gradle file has this entry:

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

What is it complaining about and how do I alleviate it?

You need to place the configuration file (google-services.json) generated by developer.google.com, as mentioned in the 2nd step of the official docs here

The process is simple

  1. You can select your project or create a new one.
  2. Then after selecting desired services (in this case the maps service), you can generate the configuration file.

    For people who have migrated to the Firebase projects they can get the same by going to Firebase Console, selecting your project and under settings you will find the configuration file.

  3. Then as quoted in step 3 of the official docs here

    Copy the google-services.json file you just downloaded into the app/ or mobile/ directory of your Android

P.S : For people downvoting this answer, please do leave a comment as to why you are down voting it.

这篇关于GoogleService无法初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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