It's pretty straightforward to install Firebase when you have only one environment. But what if you have multiple environments, such as dev
, staging
and production
? Here's a step-by-step guide.
Managing Firebase configurations becomes more complex when you have multiple environments for your application, such as development, staging, and production. Each environment requires specific configuration files and settings to ensure seamless integration with Firebase. In this step-by-step guide, we will walk you through the process of installing Firebase for different environments on both Android and iOS platforms. By following these instructions, you'll be able to set up Firebase effortlessly and efficiently for each environment, enabling smooth functioning of your application across various stages of development.
On Android, Firebase groups the different configurations in one file.
Staging
), click save, and close the windowgoogle-services.json
filegoogle-services.json
in your app
folder (android/app
in React-Native)google-services.json
in your .gitignore
On iOS, there is one Firebase configuration file per environment.
Staging
), click saveGoogleService-Info.plist
and rename it like GoogleService-Info.{APP_IDENTIFIER}.plist
tech.bam.myApp.staging
, GoogleService-Info.tech.bam.myApp.staging.plist
ios
in React-Native).pbxproj
. For example, if you're using Fastlane, add a update_app_identifier
step like:update_app_identifier(
xcodeproj: xcodeproj_full_path,
plist_path: plist_full_path,
app_identifier: ENV['APP_IDENTIFIER']
)
In XCode, in Build phases
, add a Select GoogleService-Info.plist
build step before the Copy Bundle Resources
step that contains:cp "GoogleService-Info."$PRODUCT_BUNDLE_IDENTIFIER".plist" "GoogleService-Info.plist"
In XCode, in Build phases
, add a Clean GoogleService-Info.plist
build step after the Copy Bundle Resources
step that contains:rm "GoogleService-Info.plist"
Make sure that the GoogleService-Info.plist
is listed in the resources of the Copy Bundle Resources
step
You might want to add GoogleService-Info.*.plist
in your .gitignore

Conclusion
Configuring Firebase for multiple environments is crucial for maintaining a well-structured and scalable development process. By following the outlined steps in this guide, you can easily set up Firebase on both Android and iOS platforms, ensuring proper integration and functionality for each environment. Remember to organize your configuration files appropriately and make necessary adjustments to your project settings to accommodate different environments. With Firebase successfully installed for each stage of development, you can now proceed with confidence, knowing that your application is equipped with the power of Firebase across all environments.