Changing ReactNative ArtifactID
• Mark Eschbach
At this point I am ready to release my Android application written via ReactNative. Not because it really hits any major product objectives points than it did. More along the lines of easier release cycles to the two other people who use it. First step is updating the artifact IDs to match what will be deployed in the Google Play Store.
According to StackOverflow
According to StackOverflow this looks like it might just be a slog through some files. Let us see how well it goes.
A number of Android artifacts are generated and overlayed into the class path. You will get multiple symbol errors if you do not rename the packages. I chose to rename them via Android Studio since it has a better understanding of Java and Android than WebStorm. Although it took a significant period of time to load the project the first time.
android/defaultconfig block has allows you to set the default
applicationId as one would in with any Android
application. By default, ReactNative uses
applicationId to locate bundle resources. However, the technique I am using
for duel deployment
requires telling ReactNative the default build type
android/buildTypes/debug/resValue with the
The StackOverflow Post refers to a
BUCK however that file did not exist.
_BUCK seems to have similar keys for
android_resource/package to the new package name.
/manifest[@package] should be updated to your
./gradlew clean. Afterwards, running
yarn android dev --variant=Debug --appIdSuffix=debug resulted in a working
application…the second time :-D.
Problems and potential solutions
applciationIdis being launched via
yarn android dev: Check your manifest file. ReactNative extracts the applicationId from this file.
- Java compiler produces a number of
cannot find symbolerrors related to
BuildConfig: Ensure you renamed your java packages to match your
react-native-screenswas throwing a bunch of warning messages seemingly related to changes in Kotlin. Cheating after pursing
yarn outdatedby running
yarn upgrade…which fixed that issue but not others :-).
Branding Clean Up
App now works under the new branding from the technical side. Last set of steps is to make it feel like the new name.
/resources/string[@name='app_name'] should be updated to the new human visible name. For other build types
and variants you should update those as well.