fechanique / cordova-plugin-fcm

Google FCM Push Notifications Cordova Plugin
624 stars 996 forks source link

Using with PhoneGap Build, says 'google-services.json is missing,' but it's not #195

Open jamminjames opened 7 years ago

jamminjames commented 7 years ago

I'm trying to use this plugin with PhoneGap Build. I put <plugin name="cordova-plugin-fcm" source="npm" /> in config.xml, and google-services.json in the root folder.

But the compile error message says 'google-services.json is missing,' adding: Searched Location: /project/src/release/google-services.json /project/google-services.json

The file is in the project's root folder, and I even added a src/release folder and put it there. But I keep getting this error. Any ideas? Thanks.

wellingtondessuy commented 7 years ago

I'm using Ionic and i put the google-services.json in platform root folder (platforms/[android | ios]/). It's working.

jamminjames commented 7 years ago

This particular issue seems to have been solved by using the cordova-plugin-fcm-config plugin and forking it, as recommended, so that the google-services.json is installed correctly. However, the push notifications are still not coming through to the end user. I'm at my wits end here, having tried various push notification plugins, signing up with Google Firebase, etc. I just can't get it to work in my Phonegap Build app, I know I'm missing something, but have tried to follow all the instructions. Any help would be appreciated.

peterterbe commented 7 years ago

Using ionic package build and that throws the same error.

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:
  /home/package/workspace/apps-**********/cordova/platforms/android/src/debug/google-services.json
  /home/package/workspace/apps-**********/cordova/platforms/android/google-services.json

Already tried the cordova-plugin-fcm-config, without success, it gives the same error. The google-services.json file is in the right place at platforms/android/ and its name is correct, too. How can I tell the build script to include this file in the package sent to the cloud server? (I suppose this could be the problem.)

maleavle commented 7 years ago

man how did you solve it??

peterterbe commented 7 years ago

@maleavle Me? I didn't. I had to build release versions myself, ionic package didn't worked with this plugin. For Android I could make a build on my windows machine but iOS version was tricky. I subscribed to macinthecloud.com and built the release version there.

Rand281 commented 6 years ago

I was able to resolve this issue without cordova-plugin-fcm.

My config.xml <widget> uses

<preference name="phonegap-version" value="cli-7.0.1" />
<platform name="android">
    <resource-file src="google-services.json" target="/google-services.json" />
</platform>
<plugin name="phonegap-plugin-push" spec="^2.0.0" />

Both config.xml and google-services.json are in the directory above www.

EDIT

I originally had target="../project/google-services.json" but later discovered that phonegap prepare would then create a platform named "project" which would cause an error message that I can't remember when doing something that I wish I could remember.

rastographics commented 6 years ago

@Rand281 thanks that worked for me, with one difference:

I had to specify the target value as google-services.json for the build tool to put json file in the right place (/platforms/android/google-services.json)

Rand281 commented 6 years ago

I ended up changing mine to target="/google-services.json".

ghost commented 6 years ago

I'm getting this error too

i've already placed google-services.json in both/ and /platforms/android/ any ideas? :\

maleavle commented 6 years ago

SkateFreak place it on the root before install your plugins and before create yor platform

rbenzing commented 6 years ago

I was able to resolve this in config.xml with:

`

`

SachArora commented 5 years ago

was able to resolve this in config.xml with: <resource-file src="platforms/android/google-services.json" target="google-services.json" />