简体   繁体   English

如何将“google-services.json”文件添加到Meteor / Cordova项目中?

[英]How do I add ‘google-services.json’ file to a Meteor/Cordova project?

I'm trying to add a 'google-services.json' file to the Cordova project root folder as required by the cordova-plugin-fcm plugin (this plugin allows a receiving push notifications from Google Firebase). 我正在尝试根据cordova-plugin-fcm插件的要求将“google-services.json”文件添加到Cordova项目根文件夹(此插件允许从Google Firebase接收推送通知)。 But because I'm using Meteor, the project root folder is not the same as the cordova root folder. 但是因为我使用Meteor,项目根文件夹与cordova根文件夹不同。 I've tried adding the file to both: 我已经尝试将文件添加到两个:

/<meteor project root>/cordova-build-override/google-services.json /<meteor project root>/cordova-build-override/platforms/android/google-services.json

However I still receive the following error: While adding plugin cordova-plugin-fcm@2.1.1 to Cordova project: Error: cordova-plugin-fcm: You have installed platform android but file 'google-services.json' was not found in your Cordova project root folder. 但是我仍然收到以下错误: While adding plugin cordova-plugin-fcm@2.1.1 to Cordova project: Error: cordova-plugin-fcm: You have installed platform android but file 'google-services.json' was not found in your Cordova project root folder. Its initiated by this file: https://github.com/fechanique/cordova-plugin-fcm/blob/master/scripts/fcm_config_files_process.js#L842 它由此文件启动: https//github.com/fechanique/cordova-plugin-fcm/blob/master/scripts/fcm_config_files_process.js#L842

Any idea what I'm doing wrong? 知道我做错了什么吗?

Thanks in advance 提前致谢

Apparently this is a bug with the 2.1.1 version of cordova-plugin-fcm https://github.com/fechanique/cordova-plugin-fcm/issues/212 . 显然这是一个错误的2.1.1版本的cordova-plugin-fcm https://github.com/fechanique/cordova-plugin-fcm/issues/212

I installed a different firebase plugin, cordova-plugin-firebase with my google-services.json file located at: /<meteor project root>/cordova-build-override/google-services.json 我安装了一个不同的firebase插件,cordova-plugin-firebase和我的google-services.json文件位于: /<meteor project root>/cordova-build-override/google-services.json

and everything is now working as expected. 现在一切都按预期工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM