How to use a Different google-services.json file with multiple Product flavors — Android

Different google-services.json file with Multiple Product flavors.

Image for Different google-services.json file with different 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 file with multiple product flavors, when we have different file according to the need of our project.

How you get the file:

The firebase will help you to download the 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 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 & environment.

Step1:

Make a folder in the folder and put your production file in the root folder of production, like the below screenshot.

ScreenShot for Android Studio Production folder

Step2:

Make a folder in the folder and put your staging file in the root folder of staging, like the below screenshot.

ScreenShot for Android Studio Staging folder

That’s it now sync your project with Gradle files.

Highlighted one is the sync icon

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.

Senior Software Engineer(Android). Open Source Contributor, Technical Writer, Email: Dani.amjad12@gmail.com check my website at https://danishamjad.com/