GoogleService 初始化失败 [英] GoogleService failed to initialize

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

问题描述

我在我的 android 应用程序中使用谷歌地图.我已经创建了密钥并在清单文件中添加了必要的权限.但很快我启动应用程序我在调试器中收到此消息:

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 初始化失败,状态:10,缺少预期资源:用于初始化 Google 服务的R.string.google_app_id".可能的原因是缺少 google-services.json 或com.google.gms.google-services gradle 插件.

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.

我不确定出了什么问题.地图工作正常,我可以毫无问题地使用它.我的 gradle 文件有这个条目:

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:

编译'com.google.android.gms:play-services:8.4.0'

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

它在抱怨什么,我该如何缓解?

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

推荐答案

需要放置developer.google.com,如官方文档 这里

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

过程很简单

  1. 您可以选择您的项目或创建一个新项目.
  2. 然后在选择所需的服务(在本例中为地图服务)后,您可以生成配置文件.

  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.

对于已迁移到 Firebase 项目的人,他们可以通过访问 Firebase Console 获得相同的信息, 选择您的项目并在设置下找到配置文件.

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 步中引用 这里

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

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

  • P.S :对于拒绝此答案的人,请留下评论,说明您拒绝投票的原因.

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

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