如何为现有的Google Android项目生成google-services.json? [英] How to generate google-services.json for existing Google Android project?

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

问题描述

在以下网站中,注册Android GCM时:
https://developers.google.com/mobile/add?platform=android&cntapi=signin&cntapp=Default%20Demo%20App&cntpkg=com.google.samples.quickstart.signin&cnturl=https :%2F%2Fdevelopers.google.com%2Fidentity%2Fsign-in%2Fandroid%2Fstart%3Fconfigured%3Dtrue& cntlbl = Continue%20with%20Try%20Sign-In

这里生成google-services.json文件。这在客户端是必需的。



我们如何为现有的 Google Android项目生成此文件?














$ b

您引用的页面存在的问题是您的现有项目不会显示在创建或选择应用程序下拉列表中。即使它显示我已登录到我的Google开发者帐户,也遇到了同样的问题。



我认为此页面上的会话存在问题,因此它不会加载您的项目。通过控制台帮助功能访问该页面时,我能够使其工作。



这就是我的做法。这似乎不合逻辑,但坚持与我:


  1. 退出谷歌开发者控制台

  2. 登录 https://console.cloud.google.com/home/dashboard
  3. >
  4. 在顶部的蓝色栏选择一个项目下拉列表中,选择要为其生成json文件的项目。

  5. 在顶部蓝色栏,请单击帮助图标。将弹出一个控制台帮助功能。

  6. 在帮助功能搜索栏中输入google-services.json,然后按下回车。


  7. 点击标题为在Android上设置GCM客户端应用程序的帮助项目


现在,这是它开始看起来不合逻辑的地方,因为你要去的网页以前不适合你,但是坚持我。



< ol start =7>
  • 向下滚动页面并点击蓝色的GET A CONFIGURATION FILE按钮。

    这个按钮会带你到你问题中引用的完全相同的页面。但是,您的当前应用列表应显示在创建或选择应用下拉列表中。



    这对我有用,我希望它适合您。

    >

    警告:当我这样做时,它改变了我的API密钥。我的项目编号和其他信息保持不变,但我的API密钥已更改。因此,如果您的项目依赖于您现有的API密钥,则必须处理相应的结果。


    In the following website, when registering for Android GCM: https://developers.google.com/mobile/add?platform=android&cntapi=signin&cntapp=Default%20Demo%20App&cntpkg=com.google.samples.quickstart.signin&cnturl=https:%2F%2Fdevelopers.google.com%2Fidentity%2Fsign-in%2Fandroid%2Fstart%3Fconfigured%3Dtrue&cntlbl=Continue%20with%20Try%20Sign-In

    The google-services.json file is generated here. This is required on the client side.

    How can we generate this file for existing Google Android project?

    解决方案

    I had this same problem today, very frustrating, but I finally found something that worked for me.

    The problem with the page you referenced is that your existing projects do not show up in the "Create or Choose an App" dropdown. I had this same issue, even when it showed that I was logged into my google developer account.

    I think there is a problem with the session on this page, so it doesn't load your projects. I was able to get it to work when accessing the page through the console help feature.

    This is how I did it. It seems illogical, but stick with me:

    1. Sign out of google developer console
    2. Sign in to https://console.cloud.google.com/home/dashboard
    3. In the top blue bar, "select a project" dropdown, select the project for which you want to generate the json file.
    4. In the top blue bar, click the Help icon. A Console Help feature will pop up.
    5. Type "google-services.json" into the Help feature search bar and press enter.

    6. Click on the help item titled "Set up a GCM Client App on Android"

    Now, this is where it starts to seem illogical, because you're going to go to the same pages that didn't work for you before, but stick with me.

    1. Scroll down the page a bit and click the blue "GET A CONFIGURATION FILE" button.

    This button is going to take you to the exact same page you referenced in your question. However, your list of current apps should appear in the "Create or Choose and App" dropdown.

    This worked for me, I hope it works for you.

    WARNING: When I did this, it changed my API Key. My project number and other info stayed the same, but my API Key changed. So if you have projects that depend on your existing API key, you'll have to deal with the consequenses.

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

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