Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have multiple flavors of my app. How should I set this up server side? My package names are:

com.example.app (production) com.example.app.staging (staging) com.example.app.fake (fake)

Should this be 3 separate projects in the firebase console?

like image 858
ZakTaccardi Avatar asked May 26 '16 14:05

ZakTaccardi


People also ask

How multiple developers can work on the same Android app connected to a single Firebase console?

You can't have two projects of the same package name. Even if you delete it. It will take a least 4-5 days to get deleted fully from the developer's console. So the only solution is to generate a new SHA-1 key by custom signing the app by generating a signed apk from the android studio.

Can a Firebase project have multiple apps?

A Firebase project can have one or more Firebase Apps registered to it (for example, both the iOS and Android versions of an app, or both the free and paid versions of an app).

Can two apps use the same Firebase database?

Yes, You can use the same firebase database in more than one android application as below: In the Project Overview section of Firebase Console add an android application. For adding this application first you need to give that package name.


1 Answers

Largely it will depend on how you want your project to work. You can set all three up in the same console, or you can set up as two or more different projects. Either option is valid.

Benefits of same project:

  • Share the same billing, quotas, permissions, and services (database, storage, FCM etc).
  • Environment which is the same as production.

Benefits of different projects:

  • No risk of overwriting production data or affecting production users.

If using multiple projects, you can take advantage of the build types support which will allow you to have different google-services.json files for different versions. If using one project, the same google-services.json will work for all the varieties.

Note: as CodyMace says in the comments - remember to re-download the JSON file each time you add an app!

There are things you can do to minimise risks in either case (e.g. have dev/ stage/ prod/ keys in your Database, and have similar structures underneath), but what makes sense for you is largely about tradeoffs.

If you're just starting out, I would suggest starting with one project while you're in development, and once you've launched consider moving your development environment to a separate project. Staging could go either way.

like image 175
Ian Barber Avatar answered Oct 04 '22 11:10

Ian Barber