google-services.json for different productFlavors and buildTypes

399 Views Asked by At

My project has 2 flavor

-flavor1 -flavor2

and 3 buildTypes

-release -uat -dev

How Can I add google-service.json to my project?

And What will my project structure look like?

I use

com.google.gms:google-services:4.3.5

I saw many post but It use com.google.gms:google-services:3.x.x. I am not sure that is still valid answer

1

There are 1 best solutions below

3
sasikumar On

In your project under the src directory create 3 folders and paste the different json files like this

release

    --google-service.json

uat

   -google-service.json

dev

   -google-service.json

runtime based on the build Types it will takes corresponding json