The "chunk" argument must be one of type string or Buffer. Received type object

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

  • android/build.gradle
  • android/project.properties
  • android/app/build.gradle

Then run ionic cordova build android --prod