Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add two google-services.json files in same project

I have two google-services.json files one for Google Sign-In another for Firebase storage, how can I put two files in same project. Please help me to solve this. I already have integrated Google Sign-In in my app,Now I downloaded JSON file for storage but couldn't put it in same project.

like image 408
Shiv uday Avatar asked Oct 26 '16 06:10

Shiv uday


1 Answers

There is no way to use two google-services.json files in a single Android app. The file name is the same between them and they need to be in the same location. So one will overwrite the other in that case.

However all that happens with google-services.json is that it is auto-parsed when you create a FirebaseApp. You can also specify the information needed for a FirebaseApp explicitly in your code. So by doing that you can access two Firebase projects from a single app. For an example of how to do that, see my answer to How to connect to more than one firebase database from an android App.

Another option would be to manually merge the two google-services.json files. However I recommend against that, as you're likely to overwrite the manually merged file with a new version at some point.

The final option (and the one I recommend) is to bite the bullet and migrate the files from the older Firebase project to the new one. That way you'll only need one google-services.json going forward.

like image 132
Frank van Puffelen Avatar answered Sep 20 '22 18:09

Frank van Puffelen