I am using Ionic 2. In order to make use of Googles Push Notification Service, I need to install:
ionic plugin add cordova-plugin-fcm
However, after doing so, I get this error when I try build the app:
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
E:\Development\IDE\ionic-apps\theWhoZoo\platforms\android\src\debug\google-services.json
E:\Development\IDE\ionic-apps\theWhoZoo\platforms\android\google-services.json
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
So it appears to be missing the dependency google-services.json I think. Do I need to install it? How?
I just got this (or similar) issue because (I think) I updated phonegap-plugin-push to 2.0.0-rc3
Go to your project on https://console.firebase.google.com/
There you can add platform app. When you do that, there is the download button for google-services.json
You should be get google-services.json from your Firebase console and put it in your root directory and then add this resource-file reference to config.xml :
To download a config file
Sign in to Firebase and open your project.
Click the Settings icon and select Project settings.
In the Your apps card, select the package name of the app you need a config file for from the list.
Click google-services.json.
Root directory is your project directory which you use to create your Ionic app.
It means if you create your app in directory as ‘G:/Projects/XYZApp/’ then your root directory will be ‘G:/Projects/XYZApp/’. Copy your file here and change the config.xml as answered by HugoHeneault.
A workaround would be to copy google-services.json file into the directory ‘G:/Projects/XYZApp/platforms/android/app/’, but it will require you to copy the file into this directory each time you build your app. So the option to add it in your root directory and change the preference of app in config.xml is preferable.