android - 文件 google-services.json 丢失。没有 ionic 3,Google 服务插件将无法运行

标签 android json firebase ionic-framework firebase-cloud-messaging

我正在使用 FCM 推送通知我总是收到此错误消息

"File google-services.json is missing. The Google Services Plugin cannot function without it ionic 3"

在手机上,我将我的 google-services.json 放在每个文件夹上,但没有任何工作

最佳答案

首先需要下载 google-services.json:

  1. 登录 Firebase 并打开您的项目。
  2. 点击设置图标并选择项目设置。
  3. 在“您的应用”卡片中,从列表中选择您需要其配置文件的应用程序包名称。
  4. 点击 google-services.json。

( https://support.google.com/firebase/answer/7015592 )

好的,现在您必须安装 cordova-support-google-services:

cordova plugin add cordova-support-google-services --save

然后,你必须把google-services.json放在你项目的根目录下(www文件夹外,同级),然后resource-file标签会把它复制到platforms/android/app/

接下来,放入config.xml

<platform name="android">
    <resource-file src="google-services.json" target="app/google-services.json" />
 ... 
 </platform>

注意:如果您使用版本 7 以下的 cordova-android,请指定:

target="google-services.json"

现在再次尝试构建!

关于android - 文件 google-services.json 丢失。没有 ionic 3,Google 服务插件将无法运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47647964/

相关文章:

android - 如何在 Oreo 中长时间运行后台服务?

json - 重定向循环检测到 Dart

mysql - 检查 MySQL 中的 JSON 值是否为空?

json - 只从 hasOne 关系中获取字符串

asp.net-web-api - 如何使用Firebase制作 'log in with Spotify'身份验证系统?

firebase - Firestore 安全规则 - 验证传入数据长度是否大于 2,但字段不是必需的

javascript - 如何处理由于从 Firestore DB 检索而多次运行的 UseEffect?

android - genymotion power_supply 出错

android - 将 MySQL 查询转换为 SQLite

Android 清除返回堆栈上的一些 Activity