fechanique / cordova-plugin-fcm

Google FCM Push Notifications Cordova Plugin
624 stars 989 forks source link

Build with cordova-plugin-fcm failed with TypeError: Invalid data #535

Open radiahub opened 5 years ago

radiahub commented 5 years ago

Build with cordova-plugin-fcm fails with --> Cordova 8.0.0 Android platform (cordova) 7.0.0 --> cordova plugin add cordova-plugin-fcm Installing "cordova-plugin-fcm" for android Android Studio project detected Subproject Path: CordovaLib Subproject Path: app

            Cordova FCM plugin v2.1.2 installed
            For more details visit https://github.com/fechanique/cordova-plugin-fcm

Adding cordova-plugin-fcm to package.json Saved plugin info for "cordova-plugin-fcm" to config.xml (node:9020) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Invalid data, chunk must be a string or buffer, not object

Exposure: Crashes globally the Cordova project, making it difficult to recover. Many elements from FCM (FCMplugin.js) do not remove cleanly on plugin remove, and must be removed manually.

It would be good if someone could fix it for the recent Android versions. Thanks a lot for the great job! Cheers, Denis

swaheed2 commented 5 years ago

Open the file: plugins/cordova-plugin-fcm/scripts/fcm_config_files_process.js

Change:

ANDROID_DIR + '/google-services.json'
ANDROID_DIR + '/assets/www/google-services.json',
stringsXml: ANDROID_DIR + '/res/values/strings.xml'

To:

ANDROID_DIR + '/app/google-services.json'
ANDROID_DIR + '/app/src/main/assets/www/google-services.json',
stringsXml: ANDROID_DIR + '/app/src/main/res/values/strings.xml'