Many times when developing an application, we developers need to create different builds with different configurations. Facilitating the maintenanc...
For further actions, you may consider blocking this person and/or reporting abuse
In IOS, I add in file Podfile:
=================================AND======================
change to
so this run well ^^
thank you so much, it works
Great help!
Extremely Informative article!!!!!!!
As per the documentation for react-native-config the line...
cp "${PROJECT_DIR}/../.env.development" "${PROJECT_DIR}/../.env.development"
should be...
cp "${PROJECT_DIR}/../.env.development" "${PROJECT_DIR}/../.env"
Because...react-native-config reads the .env file by default.
Please i'm having issues running the the IOS. I keep getting this error
cp: /Users/samueladeoye/Documents/open_source/client/infotech-mobile/ios/../.env.development and /Users/samueladeoye/Documents/open_source/client/infotech-mobile/ios/../.env.development are identical (not copied).
I followed all the steps but still having issues
What could be the possible solution?
I did the same as mentioned above. But, its not working when i build app from xcode. It only take dev environment even if i chose staging enviornment. However, it works fine when i build app from terminal.
Video explaination if anybody interested in it.
I was also going through this issue, this video helped me alot. Though still you'll have to manage env variables separately but flavours are well explained in this video in a very simple way. youtu.be/TvBm7UZNyy8
Hi! I'be been using this method for previous projects without any issue! Really like the approach, so I thought I'd use it in a newer project as well.
However, it seems that when building the targets locally, I need to clean the build folders for the different .env files to load during build.
Anyone else having this issue?
xcode 14.2
RN 0.71.2
react-native-config 1.5.0
I found a solution:
echo ".env.production" > /tmp/envfile
touch "${PROJECT_DIR}/../node_modules/react-native-config/ios/ReactNativeConfig/BuildDotenvConfig.rb"
Hi there! Thank you for the detailed explanation. It worked!
There is one problem on android though: If I first try to run the staging app on a blank simulator (it hasn't been installed yet), using the android:staging script, the app does get built and installed correctly, but it isn't run and I get the following error:
Error type 3
Error: Activity class {com.miles/com.miles.MainActivity} does not exist.
I am able, however, to manually run the app by tapping on its icon and it runs as expected.
The production app works properly (builds and starts as expected).
Now that I've run the production app, the staging app starts behaving normally as well.
Could you help me resolve this?
found a solution:
add "--appId=com.yourAppName.yourEnv" to the end of the script that fails. Of course ".yourEnv" should actually be ".staging" or ".development" or whichever environment fails with this error.
I wrote mine using this guide, as I encountered issues with the latest versions:
React Native Multi-Environment Setup: Android
React Native Multi-Environment/Flavour Setup: iOS
Hi @leon_arantes
1: To run app
`- "ios": "react-native run-ios --simulator=\"iPhone 14 Pro\" --scheme \"app-development\" ",
2: To Generate APK or AAB
`- "apk": "cd android && ./gradlew clean && ./gradlew assembleDevelopmentRelease",
Followed all the steps still my xcode opening the same app for dev, uat. How can I resolve this?
cp "${PROJECT_DIR}/../.env.development" "${PROJECT_DIR}/../.env"
this will work,
So in depth good read.
Superb!!! Please allow me to copy this article on my own website informativehouse.com I won't copy without your permission.
How can I run .env.stg from Xcode (not the build) directly instead of the command line react-native run?
You just choose the scheme you want to run?
@leon_arantes, what is resValue means in android productFlavors setting? Thanks.