1

I am building an Android application using Firebase. Thus, I have a google-services.json file in my root app directory. I'd like to tell Android to use a different google-services.json file when running tests, but I'm not sure how to do this. I don't want to run tests against the production database. Can anyone provide a step-by-step guide on how to configure product flavors or something to use a different google-services.json according to whether or not I am testing?

rsteilberg
  • 323
  • 2
  • 16

1 Answers1

3

Let us say you have different product flavors and corresponding Firebase applications in the firebase console project. You could get the google-services.json for each application and add them in your respective flavor directory in your application.

For example :

app/src/
beta/google-services.json
alpha/google-services.json
production/google-services.json

This here explains in detail how you could manage buildTypes along with flavors and further.

Pavan
  • 767
  • 4
  • 18