Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Build failed - Plugin with id 'com.google.gms.google-services' not found. #278

Closed
sagesan opened this issue Feb 7, 2017 · 29 comments
Closed
Assignees
Labels

Comments

@sagesan
Copy link

sagesan commented Feb 7, 2017

I have updated my normally working project today to 2.5 nativescript version, but I can no longer get it to build.

Script 'C:\Users\Sage\work\test\FCM\platforms\android\configurations\nativescript-plugin-firebase\include.gradle' line: 45

  • What went wrong:
    A problem occurred evaluating script.

Plugin with id 'com.google.gms.google-services' not found.

My plugins:

nativescript-background-http
tns-core-modules
tns-core-modules-widgets
nativescript-camera
nativescript-geolocation
nativescript-imagepicker
nativescript-telerik-ui
nativescript-maskedinput
nativescript-permissions
nativescript-plugin-firebase

I had issues with camera plugin, and they suggested an update, and now I can't even build the app.

Any help would be appreciated.

@deneshr
Copy link

deneshr commented Feb 7, 2017

Same issue here.
Version 3.9.3 is not compiling
Switched to 3.9.0 for now.

@sagesan
Copy link
Author

sagesan commented Feb 7, 2017

I am interested to know whether that worked and how did you do that?
I changed package.json to 3.9.0 (and removed android platform), but nothing changed.

@deneshr
Copy link

deneshr commented Feb 7, 2017

Try removing the node_modules folder as well.
Also make sure package.json has the version fixed like this..
"nativescript-plugin-firebase": "3.9.0",

@sagesan
Copy link
Author

sagesan commented Feb 7, 2017

Still not building, even with the node_module on 3.9.0 version

@lukashlobil
Copy link

Confirmed, 3.9.0 works fine, ^3.9.0 does not

@deneshr
Copy link

deneshr commented Feb 7, 2017

This however is not a permanent solution.
Hope @EddyVerbruggen will have a look.

@EddyVerbruggen
Copy link
Owner

Once. I. Find. Time.

@EddyVerbruggen EddyVerbruggen self-assigned this Feb 7, 2017
@vchimev
Copy link

vchimev commented Feb 7, 2017

@sagesan
Copy link
Author

sagesan commented Feb 7, 2017

I would like to ask how does 3.9.0 work for you.

I tried cutting this plugin entirely from app and it built and everything worked.
Then I set 3.9.0 in the root package.json, dropped both platforms and node_modules, tried to tns run android and still the same problem. Even tried 3.8.5, but still the same result.

Am I doing something wrong?

@sagesan
Copy link
Author

sagesan commented Feb 9, 2017

I tried to build a fresh new app with 2.5.0 Nativescript and "nativescript-plugin-firebase": "3.9.0", and it will not build. I tried 2.4.0 nativescript, still no luck. 2.4.0 with "nativescript-plugin-firebase": "3.8.5", still the same result.

How is it possible that 3.9.0 works for you? Is there something else I'm missing?

@deneshr
Copy link

deneshr commented Feb 9, 2017

Do a npm cache clean and try.
Post your package.json if still having trouble.

@sagesan
Copy link
Author

sagesan commented Feb 9, 2017

So I tns created an omg application, package.json is as follows:

{
"description": "NativeScript Application",
"license": "SEE LICENSE IN ",
"readme": "NativeScript Application",
"repository": "",
"nativescript": {
"id": "org.nativescript.omg",
"tns-android": {
"version": "2.5.0"
}
},
"dependencies": {
"nativescript-plugin-firebase": "3.9.0",
"nativescript-theme-core": "~1.0.2"
},
"devDependencies": {
"babel-traverse": "6.4.5",
"babel-types": "6.4.5",
"babylon": "6.4.5",
"lazy": "1.0.11",
"nativescript-dev-android-snapshot": "^0.."
}
}

deleted node_modules and platforms; npm cache clean; tns build android (first one hangs); tns build android into

Plugin with id 'com.google.gms.google-services' not found.

Tried with tns 2.4.0 as well.

@EddyVerbruggen
Copy link
Owner

@sagesan can you share your entire project with me?

@sagesan
Copy link
Author

sagesan commented Feb 9, 2017

That above is freshly created app using 'tns create'. Nothing was changed, I just added this plugin by 'tns plugin add nativescript-plugin-firebase'.

I could try to reinstall the entire tns on my PC, or just the Android SDKs, perhaps that could help.

@EddyVerbruggen
Copy link
Owner

.. and you didn't even add the google-services.json file to your project?

@EliuFlorez
Copy link

Same. With all versions of nativescript firebase from 3.9.0 to 3.8.5. The same problem continues. I think it is not the plugin but the new structure of NativeScript 2.5.0 since with version 2.4.0 there was no problem.

tns_firebase

The error in the console when running android or compile the project

@EliuFlorez
Copy link

In version 3.8.5 it works perfectly

@EddyVerbruggen
Copy link
Owner

Let me try and reproduce this today. Hope to be able to, and find a solution.

@EddyVerbruggen
Copy link
Owner

@EliuFlorez I just reproduced the error you had by starting a new app, copying a google-services.json to app/App_Resources/Android with a non-matching client.client_info.android_client_info.package_name.

Then created a new project with the correct package_name and the build was OK.

Are you sure your google-services.json has package_name = org.nativescript.appcube?

@EddyVerbruggen
Copy link
Owner

EddyVerbruggen commented Feb 9, 2017

UPDATE: I thought it was a lack of running tns build android before doing tns run android, but this is the real problem:

With {N} 2.5.0 the postinstall script that was automatically started after installing the plugin was broken; it prompts the user for input ('do you use firebase messaging? (y/n)'), bot the 2.5.0 swallows the prompts making the installer just hang.

So in plugin version 3.9.3 I removed the postinstall script and added instructions how to run it yourself. @sagesan is that the step you're missing? So the entire install that works for me is:

tns create firebasedemo
cd firebasedemo
tns platform add android
tns plugin add nativescript-plugin-firebase
cp /path/to/my/google-services.json app/App_Resources/Android/
cd node_modules/nativescript-plugin-firebase
npm run setup
cd ../..
tns run android

@vchimev can you also confirm this is the problem with the app you linked to? And do you have any idea why the prompts are swallowed by the CLI? {N} 2.4.0 worked fine, you can try this plugin's 3.9.2 version with {N} 2.4.0 to see what I mean. I'll open an issue in the nativescript-cli repo as well.
If you need to run that project in CI you can drop in a firebase.nativescript.json file with the required config in the root of the app.

@sagesan
Copy link
Author

sagesan commented Feb 9, 2017

@EddyVerbruggen You are correct, I forgot to add google-services.json in that fresh app.

Now the part where I messed up again: I created a copy of the project where I tried the downgrades of this plugin. However I only copied the app directory, but not the hooks. And it seems that was the cause of not being able to build the project successfully. After copying the hooks, everything builds with 3.9.0 as suggested above.

Thank you all for help!

@sagesan
Copy link
Author

sagesan commented Feb 9, 2017

Also, did anything happen to the 3.9.3 version? Because it seems to build without any issues on the original project now.

@EddyVerbruggen
Copy link
Owner

Nope, 3.9.3 didn't change as npm doesn't allow updates to package versions (luckily).

@sagesan
Copy link
Author

sagesan commented Feb 9, 2017

Ok, so it would seem that the change to tns run actually caused not actually updating plugins and it failed to built from that? So that you have to do tns build when doing update? Or what could have caused the issue?

@EddyVerbruggen
Copy link
Owner

@sagesan before {N} 2.5.0 livesync was not enabled when doing a run. About 80% of the time people had trouble using my plugins was when they ran with livesync enabled as it doesn't pick up plugin updates immediately. I always advised them to do a regular build or run and/or remove and add the platform folder. Was always a solid fix. Now with 2.5.0 livesync is enabled by default so this problem pops up more regularly.
I still advise to do a tns build <platform> after adding / updating a plugin to make sure all is synced property.

@jlooper
Copy link
Contributor

jlooper commented Feb 9, 2017

tip: I often use tns run ios --clean to ensure a true build

@vchimev
Copy link

vchimev commented Feb 10, 2017

Thanks for the clarifications, @EddyVerbruggen!

I confirm this is the problem with the app I linked to. The prompt swallowing by the CLI 2.5.0 looks like a bug to me, thank you for logging it. I'm sure the CLI guys will reveal the cause for this behavior.

@mayureshjadhav
Copy link

Not working for me. I tried all the things like removing the platform, adding the npm packages but still, i am getting the same error.

@bradmartin
Copy link
Contributor

@mayureshjadhav - did you path to the node_modules/nativescript-plugin-firebase and run npm run setup? Try that, then tns run android and the build should work. Works 100% of the time for me after figuring this out.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants