Member-only story
Setup Environment (Debug , Staging , Production) in React Native Android Application
In this article we will see how to setup debug , staging and production environment in React Native Android Application.
Recent Articles
- Setup Environment file in React Native iOS App
- Setup React Native Project
- Higher Order Component for better code readability
What does mean the debug , staging and production environment?
DEBUG (development env.)
This environment is used by us (developer) to develop and test the application.
STAGING (testing env.)
After development , we will give staging environment’s build to testers for the testing.
PRODUCTION (production env.)
This environment’s build will be deployed on the Play Store and available for the users.
whenever you make any application , whether it is web or mobile. It’s a good practise to make these environment. At the end you got to know why we have to setup these environment files.
Let’s see how to setup these environments
Step 1 →
npm i react-native-config
First add this package , after hitting this command on the terminal.
After adding this package , make sure you go to android studio and sync the project
Step 2 →
After that create three .env (debug , staging and production) file in the root folder of the project.
Open these file and create as much as variables you can
- .env.development →
ENV = DEBUG
- .env.staging →
ENV = STAGING
- .env.production →
ENV = PRODUCTION
As you can see above , we have only one variable ENV
common in all the files, only the value is different.