fechanique / cordova-plugin-fcm

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

Ionic build: google-services.json was not found #219

Open peterterbe opened 7 years ago

peterterbe commented 7 years ago

I can build on my local machine, everything is perfect, except that I can not build with ionic package service. (Which I use to build iOS packages.) The build service throws the following error: Error: cordova-plugin-fcm: You have installed platform android but file 'google-services.json' was not found in your Cordova project root folder.

Of course the file is in the right place. How can I tell the ionic package command, to zip that file into the package? Is there a platform dependent config.xml param for the plugin for example?

sansan88 commented 7 years ago

I have the same issue #212 ..

Muffon commented 7 years ago

Same here

Gabiman123 commented 7 years ago

I work with angular.js, only put the google-services.json in the root of your proyect, in the same folder of www, plugins, etc.

mounir1 commented 7 years ago

I paste this google-services.json literally evrywhere I m still getting that error where is the cordova root anyway !

peterterbe commented 7 years ago

@mounir1 It's not working me either. Finally I had to rent a mac in the cloud to build the ios version of my app.

marlosirapuan commented 7 years ago

try this:

project_root |- node_modules |- platforms |-- android |--- google-service.json |- plugins |- res |- resources |- src |- www .gitignore .config.xml .package.json google-service.json

my ionic info:

Cordova CLI: 6.5.0 
Ionic Framework Version: 2.0.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.9.1 
ios-sim version: 5.0.13 
OS: OS X El Capitan
Node Version: v4.6.0
Xcode version: Xcode 8.2.1 Build version 8C1002
abelabbesnabi commented 7 years ago

There is no issue in version 2.1.1, all I had to do is put both files: google-services.json and GoogleService-Info.plist in my application's root folder parallel to platforms folder.

sahildaga95 commented 7 years ago

@marlosirapuan - have u tried it with the latest version of Ionic, I have placed the file where you are suggesting it still shows the same error. google-services.json was not found !!

fatima9999 commented 7 years ago

I have the same problem. I search the whole folder, but this file' google-services.json ' doesn't exists. I need help

sahildaga95 commented 7 years ago

@fatima9999 - You need to download google-service.json from your firebase project console. The problem comes after you have the file and you have placed it in the root folder of Cordova still it is unable to determine the file and gives the error.

MuhammadMohsin commented 7 years ago

Issue resolved!!!!!

It happens because you didn't download config file(google-services.json) from firebase. First register your app on firebase and then download original config file (containing your app info) from it.

Please follow bellow steps : https://support.google.com/firebase/answer/7015592

Note If you already install cordova-plugin-fcm plugin then first remove it than add json file and than again run command "ionic plugin add cordova-plugin-fcm"

ron-gonzalez commented 6 years ago

Hi All I found a possible solution to this problem but I need help for finish the it.

Introduction .

  1. Local build is OK
  2. Running on emulator OK
  3. Cloud build fails with error ("cordova-plugin-fcm: You have installed platform android but file 'google-services.json' was not found in your Cordova project root folder.");

Cause This is caused because ionic framework do not upload files in root directory ! (this is the main problem)

Possible Solution I copied the files GoogleService-Info.plist and google-services.json to the same foder that the plugin script , so an Chunk data error appears. Is because the catch function do this [ process.stdout.write(err);] err is a binary data not a string or buffer. simply change it to process.stdout.write('error' + err);

so I do the ionic package build command, and checked the error is the same in ionic cloud, this means that ionic do not upload the local plugin script, instead this installs from repository . So I think that the solution should be a fork of the project with that corrections.

what do you think about this ? withch solutions did you find for your projects ?

Thanks and best regards!

Demi-ob commented 6 years ago

i realised the file i had was google-service.json and not google-services.json and now it works

ghost commented 6 years ago

found this related issue: https://github.com/fechanique/cordova-plugin-fcm/issues/232

no solution yet

Yousuf-Basir commented 6 years ago

I followed the method by @MuhammadMohsin and it worked. Thanks.

MuhammadMohsin commented 6 years ago

@gourabxz Thanks man

ronigonzalez commented 6 years ago

Hi this is not the cause in my case, in my case localy transpile was OK, the problem only occours compiling in IONIC remote Server . he problem is because the firebase files where not uploaded . In my case I solved it using ionic GIT , in Pro framework to upload all files and then compile successfully in remote.

aliwaqassi commented 6 years ago

I followed @marlosirapuan Thanks

Prodev2017 commented 6 years ago

where is Cordova project root folder?

NikhilR4447 commented 6 years ago

Hiee I have solved this issue in ionic 3 by placing the GoogleService-Info.plist where the config.xml file is placed. Then remove the cordova fcm plugin and then reinstall it and then run the command ionic cordova prepare ios

ron-gonzalez commented 6 years ago

Hi NikhilR4447, Thank you for your comment. But your suggestion is to local compille. This issue is releated to remote compilation ( Using Ionic Pro servers to compile ) That is usefull when developers have NO APPLE Environment and are creating a multi-platform product. In ionic Server choose the PLatform and compille. Sadly there is no firebase solution compilling for IOS in Ionic Servers nowadays. BEst regards, Roni

beyerdaniel2017 commented 6 years ago

Hi NikhilR4447, I also put GoogleService-info.plist file in place where is config.xml file but my app always crashed in Xcode simulator and Iphone 6+, I am not sure reason Regards

NikhilR4447 commented 6 years ago

Hi beyerdaniel2017, Can u check ur logs in xcode and give more idea about it. Also i would suggest u to create a separate app just to check this functionality first https://www.djamware.com/post/58a1378480aca7386754130a/ionic-2-fcm-push-notification use this to create a sample app

gersonmontenegro commented 6 years ago

Prodev2017, is your project folder, that's all. I mean, if you create a project using: ionic start myproject blank ...your project folder is myproject

SamiHK commented 6 years ago

@marlosirapuan thanks man !

juanjoseadan commented 6 years ago

I had the same issue posted here and solved with @marlosirapuan answer.

By the way, check that your config.xml Application ID match with Firebase Application ID, for instance if you set your firebase Application ID to com.mycompany.myapp you will need to set the same in config.xml file.

satheshsat commented 5 years ago

project_root |- node_modules |- platforms |-- android |--- app |---- google-service.json [ target file path auto generate while build app ] |- plugins |- res |- resources |- src |- www .gitignore .config.xml .package.json google-service.json [ src file path place it where you want ]

<platform name="android">
  <resource-file src="google-services.json" target="app/google-services.json" />
</platform>