0

Can I change the file name google-services.json to prod-google-services.json?

AL.
  • 36,815
  • 10
  • 142
  • 281
Krishna Agarwal
  • 131
  • 2
  • 7

3 Answers3

2

You should not change the name of the file if you intend to use it. If you're going to use different google-services.json file depending on the app environment, you should Configure Product Flavors.

See Firebase 2.0 - how to deal with multiple flavors (environments) of an android app?

Community
  • 1
  • 1
AL.
  • 36,815
  • 10
  • 142
  • 281
1

You cannot change the google service file name. You can use flavour to manage the google-services.json file.
Like this:

app/src/
flavor1/google-services.json
flavor2/google-services.json

Look here for detail.

Also, very important to note : You should not delete the google-services.json file from your app folder. Firebase will automatically use google-services.json file from flavor folder if it is present and neglect the google-services.json file from app folder. [Thanks @KrishnaAgarwal]

Community
  • 1
  • 1
captaindroid
  • 2,868
  • 6
  • 31
  • 45
  • thanks @captaindroid this works fine .Also, very important to note : **You should not delete the google-services.json file from your app folder. Firebase will automatically use google-services.json file from flavor folder if it is present and neglect the google-services.json file from app folder.** – Krishna Agarwal May 12 '17 at 08:13
  • @KrishnaAgarwal Added the note in answer also. – captaindroid May 13 '17 at 14:47
  • How to select the flavour while using the app ? – ANUJ GUPTA May 04 '18 at 13:03
1

No you can not change file name . it was detected by android gradle while building project.

PRATEEK BHARDWAJ
  • 2,364
  • 2
  • 21
  • 35