fedestylah
fedestylah

Reputation: 179

ReactNative - Dynamic package name / application id

I'm struggling to understand wherever is possible to change the package name at build time.

I'm currently using react-native-config in order to setup all my env variables. Now, I would like also to change the package name for my dev build so I can have for example multiple version installed at once E.g. com.myapp.dev com.myapp.staging.

Does anyone has any idea on how to do so?

EDIT: Android-wise I can change the applicationId from the gradle file referencing the env file but still the app won't be able to launch the MainActivity because it's still looking for the old package name.

applicationIdSuffix project.env.get("APP_ID_SUFFIX")

Looking at their documentation https://github.com/luggit/react-native-config you can do as mentioned 2 lines above

Upvotes: 1

Views: 2482

Answers (1)

Alex Belets
Alex Belets

Reputation: 406

'com.myapp.dev com.myapp.staging' is a bundle id.

I'm strongly recommending to use fastlane for this. There is a three places in project.pbxproj with hardcoded your bundle id (PRODUCT_BUNDLE_IDENTIFIER = ...). Also you have CFBundleIdentifier field in plist file.

Android a little bit easier to control but again it is happened in config files not within js.

So you can create transformation within Fastfile in fastlane that will update your configs on build action.

More about fastlane

Hope, it will help.

Upvotes: 2

Related Questions