How to use a Different google-services.json file with multiple Product flavors — Android
Different google-services.json file with Multiple Product flavors.
--
The google-services.json file is usually placed in the app/ root directory of the app module.
Now, in this article, we will learn how to use a google-services.json
file with multiple product flavors, when we have different google-services.json
file according to the need of our project.
How you get the file:
The firebase will help you to download the google-services.json
file when you need to integrate FCM, crashlytics etc..
Usage:
How to use this file for different product flavors. There are only 3 steps first step is so simple just remove the google-service.json
file from the root of the app/ module and save it your local system directory for the save side, & then make your product flavors like Production
& Staging
environment.
Step1:
Make a production
folder in the src
folder and put your production google-services.json
file in the root folder of production, like the below screenshot.
Step2:
Make a staging
folder in the src
folder and put your staging google-services.json
file in the root folder of staging, like the below screenshot.
That’s it now sync your project with Gradle files.
If you want to learn more related to Android then check it out the below link:
Sharing Knowledge is Caring 😊
Thanks for reading this article. Be sure to clap to recommend this article if you found it helpful. It means a lot to me.
If you need any help then Join me on Twitter, Linkedin, Github, and Subscribe to my Youtube Channel.