NativeScript + Firebase, new firebase project is not being picked up - firebase

I am working with Master Detail with Firebase Angular template, and I can successfully build the app locally.
But then when I try to reconfigure the app for my own firebase project, nothing seems to change. It continues to query the default app's firebase.
I have followed the instructions for changing firebase app to my own to the letter but I cannot figure out why it still keeps pointing to the old app.
These are the steps I take to change the firebase app:
I create an App in Firebase, using the app id from package.json.
I download google-services.json and copy it to App_Resources/Android/google-services.json
Additionally, I delete google-services.json from platforms/android/app, just in case.
I uninstall the previously installed App from the emulator. I event deleted and created a new emulator to make sure there are no remnants of the previously built app.
I search all the files in the project for any reference for https://car-rental-b26b7.firebaseio.com which is the default firebase app that comes with the template, and I don't find anything at all.
I also edited firebase.common.ts with the following upon successful initialisation:
.then((instance) => console.log("firebase.init done", instance),
Just to see which project its initialising.
7. Finally, I build: tns run android
And sure enough, the console log shows https://car-rental-b26b7.firebaseio.com as the project being initialised.
I know for definite it is copying the new project's google-services.json over to platforms/android/app, because when I deleted the file it refused to build, as expected. Placing the file back, it builds successfully.
But I have no idea why it continues to reference the original firebase project.
Has anyone come across something similar?

Related

Notifications not received in react native after switching firebase projects

I'm creating an app using react native and firebase messaging. Some time ago I created development firebase project and now I have to switch it to another project, but there is a problem. I created new project and changed google-services.json file in /android/app and it seems to take correct values from this file, because they are in /android/app/build/generated/res/google-services/debug/values/values.xml, but even though the values seems correct, the messaging works only with previous project, notifications from new project are not received. The configuration for both firebase projects seems almost identical and I have no clue how to fix that. I already tried deleting build directory from /android/app and running app with npm run android --reset-cache but it did nothing. Any ideas on what is the cause for that?

Creating an app variant in a firebase unity project

I have en existing app (e.g com.company.app1)made in Unity, that occasionally pulls content from firebase in the live environment (after being built).
Now I am trying to make a second build, with a different project id (com.company.app2). This second build does not use firebase after being built - it loads data from firebase before being built, and therefore already contains the needed data.
I have added com.company.app2 as a second android app in my firebase configuration, but when trying to install the resulting app2.apk there's a clash between it and the existing installed app1.apk.
Below is the error Unity is showing when I press it's "Build and Run" button.
stderr[
adb: failed to install C:\Users\*\*\*\*\app2.apk: Failure [INSTALL_FAILED_CONFLICTING_PROVIDER: Scanning Failed.:
Can't install because provider name
com.company.app1.firebaseinitprovider (in package com.company.app2) is already used by com.company.app1]
]
My question is, how can I change the provider name in app2 so both app1 and app2 can coexist on the same device?
(I need to interface with firebase shortly before building, so I can't just remove the SDK).
Alright, so I ended up just removing the SDK, that works.
Sorry to anyone who has some similar problem.

FLUTTER FIREBASE Change to new instance not working for Android

My client has recently changed their Firebase instance (meaning its under a different project, in a different google sign on). I.e. they have a new instance that they want to use for production. I created the new instance and project with a different name to avoid any confusion. So for Android i removed the old google-services.json and downloaded the new one from Firebase and copied it into the android/app directory. Then I reviewed the project level and app level gradel files. No problems there. I checked inside the new google-services.json file and can clearly see that it is pointing to the new instance of Firebase.
Here's a snippet below:
"project_info": {
"project_number": "506498949424",
"firebase_url": "https://lbds-aeb3d.firebaseio.com",
"project_id": "lbds-aeb3d",
"storage_bucket": "lbds-aeb3d.appspot.com"
},
The old name was LittleBigDeals instead of lbds.
Actually this process has worked fine for the IOS side of the project. The app is now pointing at the new database.
However when I install it on ANdroid it still retrieves data from the old database.
Is there a pointer I'm missing or that I need to refresh in the Android set up.
Any help with this would be greatly appreciated.
Many thanks.
I had this same issue yesterday. I had changed to a different Firebase project in my Flutter app. iOS worked fine but Android still was attempting to use the incorrect Firebase project, despite google-services.json clearly pointing to the new project. The issue appeared to be limited to my local machine but was very bizarre and annoying. Another developer suggested that I try the "flutter clean" command, and once I ran flutter clean and re-started the virtual Android device, it then used the correct Firebase instance.

API Key Problem by moving App between Firebase Projects

I have moved my Flutter App in Firebase from one Project to another new Project and replaced previous google-services.json with the new one. Then I tried the App it was still connected to the previous project, all data was created in the old project, even if I have deleted the app from the old project. I couldn't find a solution to fix it so I deleted the old firebase project and cleared all caches. Then the App started to return API is Invalid errors. I made sure that I dont have any multiple files or they API is written somewhere else a well. without the new google-services.json it returns the error No API Key was found so it seems to be right placed.
I ran out of ideas how to fix it. Did I miss anything?
SOLVED
I was having the same error and I solved it by deleting the build folder and then running flutter package
The only way to solve it was to change my package name and create a new App in my project. I guess the problem is internal at firebase that the old app didn't get properly deleted in the previous project.

How long it takes for a firebase hosting to work?

I followed the instructions, and deployed a simple web yesterday. At first, it kept showing the default website, saying " you've deployed successfully...", not my web.
Also, the 'firebase open' command + "Hosting: Deployed Site" leads to a undefined site:' undefined.firebaseapp.com '.
But, magically, about an hour later when I open the link from 'firebase console' again, the web showed up... I am not sure whether 'firebase open' command worked cause I didn't try.
Today, I added some features, and deployed again. In the firebase CLI, it said deployed. But, the link still showed the old version.
I'll catch up an hours later to see whether it works, but even it works, it takes too long.
has anyone had the same experience? what's wrong with my web?
Thanks.
This is how I solved this issue for my angular 7 app deployment on Firebase hosting:
ng build --prod
go to dist/myproject and run command Firebase init and...
I went to dist/myproject that now contain build files along with Firebase related files. Copy all files except Firebase related files to dist folder in side dist/myproject.
there you will get overwrite warning just select overwrite option.
after copy process completes, run command Firebase deploy.
after completion of process go to shown URL and there you will find your running app.

Resources