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
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.
Same issue here.
Version 3.9.3 is not compiling
Switched to 3.9.0 for now.
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.
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",
Still not building, even with the node_module on 3.9.0 version
Confirmed, 3.9.0 works fine, ^3.9.0 does not
This however is not a permanent solution.
Hope @EddyVerbruggen will have a look.
Once. I. Find. Time.
Hey @EddyVerbruggen,
This also hit the https://github.com/NativeScript/nativescript-marketplace-demo app.
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?
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?
Do a npm cache clean and try.
Post your package.json if still having trouble.
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.
@sagesan can you share your entire project with me?
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.
.. and you didn't even add the google-services.json file to your project?
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.

The error in the console when running android or compile the project
In version 3.8.5 it works perfectly
Let me try and reproduce this today. Hope to be able to, and find a solution.
@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?
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.
@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!
Also, did anything happen to the 3.9.3 version? Because it seems to build without any issues on the original project now.
Nope, 3.9.3 didn't change as npm doesn't allow updates to package versions (luckily).
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?
@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.
tip: I often use tns run ios --clean to ensure a true build
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.
@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.
Most helpful comment
UPDATE: I thought it was a lack of running
tns build androidbefore doingtns 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:
@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.jsonfile with the required config in the root of the app.