-
Notifications
You must be signed in to change notification settings - Fork 992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid data, chunk must be a string or buffer, not object #213
Comments
+1 |
1 similar comment
+1 |
I get same problem, i solve this issue by running "ionic platform update android" |
+1 |
Same here. Can't do anything until I remove the plugin. |
Possible solution: The first google-services.json I got didn't have an API key. I opened the firebase project settings and re-downloaded the file. Now it contained the API key and it's working. |
Same error here, this work for me: open file platforms/andoid/res/values/strings.xml then add 2 rows (that there aren't present): |
I add the string: Still; get the same problem. Any help here? |
It just platform issue, try to remove and add the platform, also remove and add the plugin. |
I was able to "fix it" by renaming (e.g. resetup/recreate App) the App from something like Test App & Test to Test App and Test As far as i can tell the & or |
I resolve with:
|
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 |
Weird, @loveonwheels, in my case it ONLY works, if the plist and json files are located in root folder. |
In my case, just removing the plist and the json from the root file and having these files on the respective platform/android - ios folder works. Don't need to remove the whole platforms, that's too much! |
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. |
I have resolved this problem by doing what @loveonwheels said. |
@circuitrider solution nailed it for me. |
Resolved issue on IOS by adding 2 Resources folders under platform/ios/app name/Resources/Resources and placing the googleservices-info.plist in first resources folder. |
[SOLVED] 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. Thanks |
for any one still have the same issue after trying remove and add platform , you should download the google-services.json file and GoogleService-Info.plist from your firebase account from your project there , because it has the API keys and IDs needed ,, |
Edit: |
+ 1.. Problem still exists... |
@walfro Does your solution only applies to people trying to run they projects on an iOS device? |
@jeenn Yes, this solution applies for iOS only, I didn't have any issue for Android at that time. Are you having this error in Android? let me know and I might be able to help you. Thanks, |
@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:
|
In android i changd cordova-android ver then error message disappeared |
@skout90 Did you just downgraded your |
@jeenn cordova plugin rm cordova-plugin-fcm
cordova platform rm ios
cordova platform rm android
cordova plugin add cordova-plugin-fcm
cordova platform add ios
cordova platform add android |
dont forget delete the plataform folder |
@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: The I don't know how to write plugins or how anything works in cordova, so it's just a guess.
(crosswalk-project/cordova-plugin-crosswalk-webview/issues/188) Edit: Edit Edit: ...
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 And change |
Cordova 7.0+ changed the android paths structure, this should fix that problem and also maintain compatibility with older versions
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:
|
Please update @ketanyekale changes to master ? |
@ketanyekale works! 👍 Thanks |
I tried above all solution but no one works for me for android.Please Help ! |
@ketanyekale works! |
@krinakis, if you have already added the platforms before modifying the file plugins/cordova-plugin-fcm/scripts/fcm_config_files_process.js, you need to remove the platform android and add it again. |
solution from @ketanyekale did the trick |
Hi, |
Finally a solution that works @ketanyekale 👍 🥇 although a shame that it still hasn't been fixed in the main branch. Did look like an issue regarding paths as it couldn't read from the json file but didn't know how to fix that. Good work 👍 💯 |
In recent versions of |
tested the @ketanyekale solution in |
@ketanyekale fix work perfectly in [email protected]. Thanks. |
@ketanyekale Thanks your solution fixed the problem ([email protected]) |
@ketanyekale thanks for the solution..its working for me too |
I had this problem trying to deploy for android and the solution for me was to remove the ios platform. After that I could add the android platform and build the apk without any problem. Hope this helps! |
I was getting this error duing building Android on Windows. |
fixed issue fechanique#213 strings.xml path has changed in later version
pull request made to fix this issue #575 |
I am still getting this error with [email protected]
|
for those still facing this issue
|
I run this to add this plugin in my project:
cordova plugin add cordova-plugin-fcm --save
At the end I get this error:
Invalid data, chunk must be a string or buffer, not object
`Fetching plugin "cordova-plugin-fcm" via npm
Installing "cordova-plugin-fcm" for android
ANDROID_HOME=C:\Users\mkhairunns\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_20
Subproject Path: CordovaLib
Incremental java compilation is an incubating feature.
:clean
:CordovaLib:clean
BUILD SUCCESSFUL
Total time: 9.497 secs
Subproject Path: CordovaLib
gin-fcm
Saved plugin info for "cordova-plugin-fcm" to config.xml
Error: Invalid data, chunk must be a string or buffer, not object`
The I try cordova build android, I get same error:
Invalid data, chunk must be a string or buffer, not object
This is my config.xml:
<?xml version='1.0' encoding='utf-8'?> <widget id="my.com.sains.FCMtest" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>FCMtest</name> <description> A sample Apache Cordova application that responds to the deviceready event. </description> <author email="[email protected]" href="http://cordova.io"> Apache Cordova Team </author> <content src="index.html" /> <access origin="*" /> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-intent href="tel:*" /> <allow-intent href="sms:*" /> <allow-intent href="mailto:*" /> <allow-intent href="geo:*" /> <platform name="android"> <allow-intent href="market:*" /> </platform> <platform name="ios"> <allow-intent href="itms:*" /> <allow-intent href="itms-apps:*" /> </platform> <plugin name="cordova-plugin-whitelist" spec="~1.3.1" /> <plugin name="cordova-plugin-fcm" spec="~2.1.0" /> </widget>
Any help?
The text was updated successfully, but these errors were encountered: