Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Invalid data, chunk must be a string or buffer, not object #213
I run this to add this plugin in my project:
At the end I get this error:
`Fetching plugin "cordova-plugin-fcm" via npm
Total time: 9.497 secs
Saved plugin info for "cordova-plugin-fcm" to config.xml
The I try cordova build android, I get same error:
This is my config.xml:
1 similar comment
referenced this issue
Feb 22, 2017
any one still having this error do this
copy the GoogleService-Info.plist into platforms/ios/'app name'/Resources
for me thats what caused the error i had another GoogleService-Info.plist in my root folder
Doing these actions in specific order seems to be a reliable solution from my research:
Definitely set me back a day or so of work trying to get this worked out, I hope this can save at least one person the same trouble.
In my case I had to edit file "fcm_config_files_process.js" located in folder "plugins/cordova-plugin-fcm/scripts/":
For some unknown reason while building the project this line (42) was throwing the error "Invalid data, chunk must be a string or buffer, not object" so what I did was to comment that line and then manually copy the file "GoogleService-Info.plist" to "platforms/ios/" + name + "/Resources/"
Hope this can help.
referenced this issue
Aug 16, 2017
@walfridosp Yes, I'm having this issue when I try to run my ionic project in an Android device.
Do you have any idea what could I be doing wrong?
@jeenn Did you try installing the plugin in a clean project? My idea of what could be happening is:
@fechanique the problem could be here maybe the new cordova version automatically puts the resource file in the resource folder. When i try to install the plugin i end up with a folder structure like this:
I don't know how to write plugins or how anything works in cordova, so it's just a guess.
... var contents = fs.readFileSync(path).toString(); fs.writeFileSync("platforms/android/google-services.json", contents); // <- here var json = JSON.parse(contents); var resourcesPath = "./platforms/android/app/src/main/res/"; var strings = fs.readFileSync(resourcesPath + "values/strings.xml").toString(); // <- here ... fs.writeFileSync("platforms/android/res/values/strings.xml", strings); // <-- and here
To fix this change the paths on lines 61 and 78 from
added a commit
Jan 8, 2018
I got the fix from one of the forked repo. It just needed correct path for strings.xml.
There is no need to downgrade cordova or cordova-android
The fix is to replace the code in /cordova-plugin-fcm/scripts/fcm_config_files_process.js as below:
Please consider fixing it quickly and release a new version.
For manually fixing the issue:
Feb 18, 2018
In recent versions of