2

I am building an Android and iOS app that will use Google Cloud services via Firebase (authentication, data, messaging, etc). How do I set up the Firebase project for a release process? I'm envisioning there will be a development, staging, and production environment.

According to How to setup a different Firebase project for Debug and Release environments, you should set up a separate Firebase project for each environment.

However, I got an error when I tried to add the Android project to multiple Firebase projects:

A Firebase or Google Cloud project contains an OAuth 2.0 client ID (such as another registered Android app) that has the same package name and SHA-1 key that's listed for one of your Android apps in this project. Before you can download this config file, you'll need to resolve this issue.

I figured I should reuse the same Android project across Firebase projects because the Android development system has a mechanism for multi-stage release, namely the buildType. I thought I would try to set it up as follows:

  1. android-proj buildType "debug" points to firebase-proj-dev
  2. android-proj buildType "staging" points to firebase-proj-staging
  3. android-proj buildType "release" points to firebase-proj-prod

The Google Firebase error above leads me to believe the multi-stage release process can't or shouldn't be set up this way.

Does anyone know a better way to set up the environments for a multi-stage release process where the following components are involved:

  1. Android app
  2. iOS app
  3. Google Firebase services (Database, Storage, Functions, etc.)

Ultimately, I'd like three independent environments, particularly for the database: development, staging, production.

Michael Osofsky
  • 11,429
  • 16
  • 68
  • 113
  • 2
    You use different projects, one for each environment. This is the only sane way to manage the whole process. Trying to use the same project for everything will only cause you problems going forward. – Doug Stevenson Jul 21 '19 at 01:19
  • Thx @DougStevenson, I may have a solution based on https://stackoverflow.com/questions/37450439/separate-dev-and-prod-firebase-environment. I define 3 Firebase projects (dev, staging, prod) and in each one I link to the Android project using a different applicationId to avoid the error. o give the Android project different applicationId per `buildType`, I use `applicationIdSuffix`. Lastly, I only enter the Debug signing certificate SHA-1 for the Android project that's actually for debug. I left it blank for staging and prod. When I'm ready to sign them I can enter actual SHA-1. Make sense? – Michael Osofsky Jul 22 '19 at 00:49

0 Answers0