fechanique / cordova-plugin-fcm

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

Compiling on Phonegap Build not working #73

Open BSchwetzel opened 7 years ago

BSchwetzel commented 7 years ago

Hey,

I'm having a problem when building on Phonegap Build (the cloud service):

:processDebugGoogleServices FAILED

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: 
  /project/src/debug/google-services.json
  /project/google-services.json

I'm using cli-6.3.0 for the build, I'm uploading a zip file. It fails regardless of where I put the file:

/
    google-services.json
    www/
        config.xml
        [Other Files]
/
    www/
        config.xml
        google-services.json
        [Other Files]
/
    www/
        config.xml
        [Other Files]
    project/
        google-services.json

The iOS file is, of course, also there, but there the build fails for some other reasons (the log doesn't indicate a failure related to FCM).

Has anyone got an idea?

gtribut commented 7 years ago

I get same problem. I try to upload by zip or use git pull, put google-services.json file in different places, but I always get the error message

:processDebugGoogleServices FAILED
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: 
  /project/src/debug/google-services.json
  /project/google-services.json

Is there a special location where to put files to be copied at the root for each platform ? I try to put in "locales/android/" but it doesn't work.

twicejr commented 7 years ago

+1 . Android build fails! (iOS build works here, but had no time to test the resulting App yet..)

imirs commented 7 years ago

Any solitions? Same problem for me

ironbone commented 7 years ago

The same using cordova. I have the google-services.json in the root directory. I can solve this problem when I put this file into platforms/android But in the documentation the place for this file is the root directory

ironbone commented 7 years ago

Yo can also solve it by using this additional plugin: https://github.com/stetro/cordova-plugin-fcm-config Tested for on Android projects

Eccenux commented 7 years ago

@ironbone How do you use cordova-plugin-fcm-config with PGB?

My steps:

  1. I've added <plugin name="cordova-plugin-fcm-config" spec="https://github.com/stetro/cordova-plugin-fcm-config" /> to my config.xml.
  2. I've also added google-services.json and GoogleService-Info.plist to my package.zip.
  3. Upload zip for compilation.

In log I see:

Parsing json file: /project/google-services.json
:processDebugGoogleServices FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugGoogleServices'.
> Missing project_info object

So seems like google-services.json is empty.

twicejr commented 7 years ago

I gelieve, for now, the only way with PGB is to fork the cordova-plugin-fcm(-plus ) in a private repository, add the Services files hardcoded, and then in phonegap use a private project, and use https://user:pass@bitbucket.org/reponame as a plugin in config.xml

Eccenux commented 7 years ago

Thanks! I've added a special user for PGB with read-only access to the repo and it works fine. Didn't know bitbucket offers free private repos :-).

osielcc commented 7 years ago

change the location from the file google-service.json to /project/

karthik-ehash commented 6 years ago

@twicejr

We are almost there, but stuck on the same issue you had. Hope you could help.

  1. Do we need to put the project files or just the cordova-plugin-fcm in a private repo and do a PG build?
  2. Please clarify on 'add the Services files hardcoded' comment?

Thx.

twicejr commented 6 years ago
  1. No, just the plugin in a private repo, which you reference from config.xml.
  2. I put the service files googleservices.xml and the other for Apple directly in my plugin private repository. This is bad practice of course, hence the private repo. It should look in your own repository instead, but that did not work for me in phonegap build.
twicejr commented 6 years ago

Please try what osielcc said first, though

karthik-ehash commented 6 years ago

@twicejr

Thx for the quick response. Working on it, will update the results tomorrow.

karthik-ehash commented 6 years ago

I couldn't get the phonegap to work with FCM. I have used Cordova Command-line-interface (CLI) to build the app (instead of PhoneGap) and it worked.

thanks for the help.

bitterdev commented 6 years ago

Hello.. Any news about the problem? Maybe another solution as forking the repo?

eyalish commented 6 years ago

@twicejr @Eccenux After trying to compile in PGB I get this error on Log:

Repository "https://eyalish:xxxx@bitbucket.org/eyalish/cordova-plugin-fcm.git" checked out to git ref "master" at "5bd09ec".

Either there is a connection problems, or plugin spec is incorrect: Cannot find plugin.xml for plugin "1517826896997". Please try adding it again.

using CLI 8.0.0 using private bitbucket repo. [I used the master branch]. Any Ideas to fix this to work?

Eccenux commented 6 years ago

@eyalish You will need to fork (copy) cordova-plugin-fcm-config repo to your bitbucket repo. See readme: https://github.com/stetro/cordova-plugin-fcm-config#howto

Only the last part (about config.xml) is different and more like: <plugin name="cordova-plugin-fcm-config" spec="https://readonly-user:password@bitbucket.org/username/cordova-plugin-fcm-config.git" />

Also note that

  1. bitbucket.org/username/cordova-plugin-fcm-config.git should be the address of your private repo you created on Bitbucket.
  2. readonly-user should be a special user you create with read-only access to the repo.

This is due to security concerns.

eyalish commented 6 years ago

@Eccenux thanks. It says over the config plugin it is not necessary with FCM plugin 2+... I saw there are users on Bitbucket named "Phonegap builder" are these official ones? I will create new readonly-user access and see how it goes.

twicejr commented 6 years ago

I dont know, but should you not hide your password here? Btw, I got denied access, so.. I suppose that is in this case a good thing.

Git server of bitbucket seems to want you to use https and then supply the password securely.. How you do it with phonegap? Dont know man.

If desperate and cannot change a setting in bitbucket or something, maybe setup your own git server ?

Op 7 feb. 2018 17:08 schreef "eyalish" notifications@github.com:

@Eccenux https://github.com/eccenux, okay I manage to compile in PGB the config git :) But when I add the fcm plugin I get another error:

remote: Unauthorized fatal: Authentication failed for 'https://pushfcm:066145699@ bitbucket.org/eyalish/cordova-plugin-fcm.git/'

two plugins are declared the same where the config is first (whereas pushfcm is a new special user with access to both)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fechanique/cordova-plugin-fcm/issues/73#issuecomment-363819006, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMqC9ggqm7-Wpnxkmx3FVcWBGZ1gEWTks5tScpugaJpZM4JlKZX .

to1sourceuk commented 5 years ago

The same problem still happening. And strangely, The search path(s) don't make any sense.

  /project/src/nullnull/debug/google-services.json
  /project/src/debug/nullnull/google-services.json
  /project/src/nullnull/google-services.json
  /project/src/debug/google-services.json
  /project/src/nullnullDebug/google-services.json
  /project/google-services.json

I have the google-services.json in platform/ platform/app and platform/app/src all failed.

eyalish commented 5 years ago

@joelchucn put the services file outside the www folder, and then zip them both. it worked for me back then. the plugin works for me I just don't use it much