Ionic cordova-plugin-fcm UnhandledPromiseRejectionWarning

Ionic cordova-plugin-fcm UnhandledPromiseRejectionWarning



I'm trying to run my Ionic app in an Android device with cordova-plugin-fcm but I get the error below when I try to install it (cordova plugin add cordova-plugin-fcm) or run it (ionic cordova run android). The plugin is listed in cordova plugins despite of the error.


cordova plugin add cordova-plugin-fcm


ionic cordova run android



(node:2360) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Invalid data, chunk must be a string or buffer, not object (node:2360) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.



Versions:



ionic CLI: 3.19.0



cordova: 8.0.0



cordova-android: 7.0.0





Note that the first and last line here aren't really relevant to your problem: they're warnings that are produced by node.js that indicate that cordova's using a node API that's going to change in a future version. That change hasn't happened yet, though, so the warning shouldn't actually be a problem. The middle line of your messages is the relevant one, and I'm afraid I can't help you with that one.
– Jules
Jan 9 at 23:34





The problem is that in Cordova version 8.0.0 Android platform has changed its structure so the plugin goes crazy because it can't find the file it needs. So there are 2 temporary solutions: 1. Downgrade Cordova 2. Downgrade Android platform
– FranSto
Jan 10 at 12:43





3 Answers
3



problem is with the cordova-android version you have installed.
I tried it with android@6.3.0 and the plugin installed without any error



With cordova-android@7.0.0 the directory structure has change but downgrading shouldn't be an option.



Please check my comment for the issue in cordova-plugin-fcm GitHub repository:
https://github.com/fechanique/cordova-plugin-fcm/issues/213#issuecomment-357162384



Just had the same problem with cordova 8.0 and android 7.0



Workaround is to update fcm_config_files_process.js in the plugin folder.
Make the following changes:



Replace "platforms/android/res/values/strings.xml" with "platforms/android/app/src/main/res/values/strings.xml"



Replace "platforms/android/google-services.json" with "platforms/android/app/google-services.json"



Like others have said, the problem is that directory paths have changed. But it's not difficult to just update them in that js file. I'm surprised they haven't fixed this by now.



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Some of your past answers have not been well-received, and you're in danger of being blocked from answering.



Please pay close attention to the following guidance:



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế