I am trying to run the command to run my ionic 3 Command prompt. I used cordova fcm plugin.
ionic cordova run android
ERROR:
The "chunk" argument must be one of type string or Buffer. Received type object
Ionic:
ionic (Ionic CLI) : 4.10.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.6.0 @ionic/app-scripts : 2.1.4
Cordova:
cordova (Cordova CLI) : 8.1.2 ([email protected]) Cordova Platforms : android 7.1.4 Cordova Plugins : no whitelisted plugins (25 plugins total)
System:
NodeJS : v10.15.1 (/Users/sivakumarv/.nvm/versions/node/v10.15.1/bin/node) npm : 6.4.1 OS : macOS High Sierra Xcode : Xcode 10.1 Build version 10B61
Environment Variables:
ANDROID_HOME : C:\Users\pkhon\AppData\Local\Android\Sdk
There is a bug in the plugin, to solve this: go to:
plugins/cordova-plugin-fcm/scripts/fcm_config_files_process.js
Now change the file like this:
// change
var strings = fs.readFileSync("platforms/android/res/values/strings.xml").toString();
// to
var strings = fs.readFileSync("platforms/android/app/src/main/res/values/strings.xml").toString();
// AND
//change
fs.writeFileSync("platforms/android/res/values/strings.xml", strings);
//to
fs.writeFileSync("platforms/android/app/src/main/res/values/strings.xml", strings);
After that, copy the google-services.json
file to the following directories:
- platforms/android/google-services.json
- platforms/android/app/google-services.json
For more information, you can check this bug here
Along with the changes mentioned above https://stackoverflow.com/a/56330922/5698147 by Asim Hashmi , also manually search & replace the firebase versions to
firebase-core:16.0.3
firebase-messaging:17.6.0
in
Then run ionic cordova build android --prod
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With