13

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.

adjuremods
  • 2,938
  • 2
  • 12
  • 17
Shiv uday
  • 293
  • 1
  • 3
  • 10
  • why do you need two google-services.json? You do not need two different google-services.json files. Both will have identical configurations. These configuration files are unique for every project irrespective of how many services you have activated. Look [Here](http://stackoverflow.com/questions/35012700/how-to-integrate-two-or-more-google-services-json-file-together-for-different-go) – ZeroOne Oct 26 '16 at 06:41
  • 2
    yeah first i have included google sign in in different gmail account and now am adding firebase in different gmail account..now am not able to put both json files in same project which have different configuration in each.how can i solve this. – Shiv uday Oct 26 '16 at 06:51
  • 1
    @Shivuday could you solve this issue? please share your solution. I am also facing this – Liya Oct 11 '17 at 07:12

2 Answers2

6

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.

Community
  • 1
  • 1
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
0

if you are using two json file in one app your app will crash and you need to check the google analytics or both the accounts so its better to use same gmail account for your all app development, thank you, :-)

Sam
  • 45
  • 1
  • 8