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

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

Danish Amjad
AndroidPub

--

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 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.

--

--

Danish Amjad
AndroidPub

Senior Mobile Engineer (Android). Open Source Contributor, Technical Writer, ✉️ Dani.amjad12@gmail.com 🔗 https://danishamjad12.github.io