还有其他地方可以得到google-services.json吗?

Is there another place to get a google-services.json?

我尝试从 the docs, but the resulting page 中单击 GET A CONFIGURATION FILE link 只是加载和加载。这发生在 Firefox 和 Chrome 以及我的 phone 上。还有其他方法可以获取配置文件吗?

编辑:我在 Chrome 开发控制台中收到这些错误:

Refused to display 'https://accounts.google.com/ServiceLogin?service=cloudconsole&osid=1&passiv…ed%253Dtrue%26cntlbl%3DContinue%2BAdding%2BSign-In%26cntapi%3Dsignin&hl=en' in a frame because it set 'X-Frame-Options' to 'DENY'.
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://console.developers.google.com') does not match the recipient window's origin ('null').(anonymous function) @ script_foot.js:348n.event.dispatch @ jquery.min.js:3r.handle @ jquery.min.js:3

这可能是由于网络连接或类似原因导致的暂时性问题。

一个解决方案是稍后重试。发生这种情况的原因可能是您正在尝试为示例项目 (com.google.samples.quickstart.signin) 下载 google-services.json

如果您现在想要结果,您可以按照步骤将 Google 登录集成到您的应用程序中。

  1. 创建一个新的空 android 工作室 project/if 你有一个现有的 项目跳过这一步。
  2. 使用此 link 并按照屏幕上的说明为您的应用生成 google-services.json

  1. 这里的app名称是指你在GoogleDevelopers中的项目名称 控制台。如果您已经设置了 Google 开发者控制台 为您的 android 应用项目,您可以 select 通过下拉菜单 菜单。如果您还没有创建一个,只需输入一个名称,然后 项目将在您的开发人员控制台中为您创建。

  2. Select 您的项目所需的 google 服务,即 Google 签名
    在 Google Cloud Messaging、AdMob 等中。在我们的例子中,我们只是 selected Google 登录。

  3. 系统会要求您提供 SHA-1 哈希值。关注these steps获得一个。

  4. 点击生成配置文件。下一个屏幕将显示为您的应用程序下载 google-services.json 的选项。下载它,你就可以开始了。

  1. 获得 google-services.json 后,请按照 these steps 完成 Google 登录。

参考资料

  1. Start Integrating Google Sign-In into Your Android App,
  2. Integrating Google Sign-In into Your Android App.

好的,如果其他人遇到此问题,我已经找到解决方法。

根据无法在框架中显示https://accounts.google.com/ServiceLogin?service=cloudconsole&osid=1&passiv…ed%253Dtrue%26cntlbl%3DContinue%2BAdding%2BSign-In%26cntapi%3Dsignin&hl=en的错误信息...我直接按照link。

编辑:其他 link 中的 None 为我工作。如果您是来搜索控制台错误 Refused to display...,这就是您的答案。此错误似乎已针对 google-services.json 修复,因此如果您只是在寻找 link,评分最高的答案就是您想要的。

您将在创建 Firebase 项目后立即获得 "google-services.json"

但是,如果您错过并忘记下载它,您仍然可以从现有项目中获取 JSON 文件-

  • 只是 select 来自 firebase 控制台的项目。
  • 前往项目设置
  • 向下滚动(是的!就是它!)

截图:

参考this页:

The Firebase console will help you download the google-services.json. In addition, the Quickstart guides for most APIs have instructions for generating this file. Once you have downloaded the google-services.json file, copy it into the app/ folder of your Android Studio project, or into the app/src/{build_type} folder if you are using multiple build types.

因此转到 Firebase Console,按添加新项目并按照说明进行操作