Comments (6)
@wkoutre thanks! I will try
from react-native-ultimate-config.
@wkoutre any update?
from react-native-ultimate-config.
@pcaro10 I haven't heard anything about this one, no, nor have I looked into it further.
In the production apps I manage, I've just been using the workaround I've mentioned above:
If I remove project.ext.flavorEnvMapping, run yarn rnuc env.staging.yaml, then run react-native run-android --variant devDebug (or cd android; ./gradlew assembleDevDebug), everything works perfectly without any other changes.
from react-native-ultimate-config.
I am having the same problem and tried various steps with no avail. I had to run the yarn rnuc .env.staging.yaml
first.
from react-native-ultimate-config.
I had a similar issue, but for me I needed to adjust the android versionCode
dynamically based on the flavor (dev / prod).
I have two yaml files, which are setup in the following way:
project.ext.flavorEnvMapping = [
prod: "../.env.prod.yaml",
staging: "../.env.staging.yaml",
]
and I attempted to do something like the following:
defaultConfig {
applicationId <MY_APP_ID>
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode project.config.get("APP_BUILD_NUMBER")
versionName project.config.get("APP_VERSION")
}
This however, failed when created an app bundle, with the error: "Version code not found in manifest".
Apparently, project.config.get
is null, and both APP_BUILD_NUMBER
and APP_VERSION
came back as null as well (Obviously).
I traced the code back to "../../node_modules/react-native-ultimate-config/android/rnuc.gradle"
.
There, you can see that at the end of the script, the following is being done: project.ext.set("config", rootConfig)
.
rootConfig
is a map containing all the flavors with all their keys.
I went on to print it, inside defaultConfig
like so:
defaultConfig {
println "MY CONFIG ${project.config}"
applicationId <MY_APP_ID>
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode project.config.get("APP_BUILD_NUMBER")
versionName project.config.get("APP_VERSION")
}
The result looked like so:
MY CONFIG [prod:[BASE_URL:<OMITTED>, IS_PROD:true, ENVIRONMENT:production, TARGET_NAME:<OMITTED>, APP_NAME:<OMITTED>, APP_BUILD_NUMBER:36, APP_VERSION:1.1.3], staging:[BASE_URL:<OMITTED> IS_PROD:false, ENVIRONMENT:staging, TARGET_NAME:<OMITTED>, APP_NAME:<OMITTED>, APP_BUILD_NUMBER:40, APP_VERSION:1.2.0]]
so the project.config
is just a dictionary containing the values per flavor.
My end working solution now looks like this:
productFlavors {
prod {
applicationId <PROD_BUNDLE_ID>
versionName project.config.prod.APP_VERION
versionCode project.config.prod.APP_BUILD_NUMBER
}
staging {
applicationId <STAGING_BUNDLE_ID>
versionName project.config.staging.APP_VERION
versionCode project.config.staging.APP_BUILD_NUMBER
}
}
Granted, this is not Ideal, but it works, and achieves the needed result.
I hope this helps someone.
Although it is kind of a bug to be honest, I would've expected the lib to deliver these values automatically
from react-native-ultimate-config.
I had the same issue when trying to set applicationId
with flavors. This is what I ended up doing:
productFlavors {
dev {
}
production {
}
all { flavor ->
applicationId project.ext.config.get(flavor.name).get("APP_ID")
}
}
from react-native-ultimate-config.
Related Issues (20)
- Warning on build: ios/rnuc.xcconfig: line 1: //: is a directory HOT 4
- is it possible to keep env based package name in proguard-rules.pro? HOT 2
- Build Failure - RN 0.69.1 HOT 30
- Android JCenter - build failure HOT 3
- expo 47 compatible ? HOT 2
- RN issue: Cannot choose between the following variants of com.facebook.react:react-native HOT 4
- Cannot choose between the following variants of com.facebook.react:react-native:0.70.6: HOT 2
- Error React Native IOS Undefined symbol: _RCTRegisterModule HOT 1
- Build error on 0.71.2: 'RNUltimateConfigSpec.h' file not found HOT 7
- Doc/Quickstart (minor): `npm bin` deprecated in Node 18.14 HOT 1
- Gradle 8 support HOT 4
- Could not set unknown property 'classifier' for task
- Packaging error
- Multiple env files possible? HOT 1
- Kotlin support
- '$' is not recognized as internal or external command HOT 1
- Error: Cannot resolve ./override HOT 8
- Does this package support use_frameworks! :linkage => :static ? HOT 1
- Firebase Initialization Issue with react-native-ultimate-config in NX Monorepo
- How to access from shell scripts HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-ultimate-config.