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

I have two google-services.json files, one for logging into Google and the other for Firebase storage, how can I put two files in one project. Please help me solve this problem. I already have a built-in Google login feature in my application. Now I uploaded the JSON file for storage, but could not put it in one project.

+6
source share
2 answers

It is not possible to use two google-services.json files in the same Android application. The file name is the same among themselves, and they should be in one place. Thus, in this case another one will be overwritten.

However, all that happens with google-services.json is that it is automatically processed when FirebaseApp . You can also specify the information needed for FirebaseApp explicitly in your code. This way you can access two Firebase projects from one application. For an example of how to do this, see my answer to How to connect to multiple firebase databases from an Android application.

Another option would be to manually merge the two google-services.json files. However, I recommend against this, since you can probably overwrite the file merged manually with the new version at some point.

The last option (and the one I recommend) is to bite the bullet and transfer the files from the old Firebase project to the new one. This way you will only need one google-services.json in the future.

+4
source

if you use two json files in one application, your application will fail, and you need to check Google analytics or both accounts so that it is better to use the same gmail account for your entire application development, thanks :-)

0
source

Source: https://habr.com/ru/post/1011703/


All Articles