
Because of how the script works, it takes any line with the word 'package' in it and replaces it. It has the word 'package' in the comment. android/app/src/main/java/com/MyWebsite/MyAppNameĭISCLAIMER: You'll need to edit MainApplication.java's comment near the bottom of the java file first. Sed -i '' -e "s/.*applicationId.*/ applicationId \""$packageName"\"/". android/app/src/main/AndroidManifest.xml android/app/src/main/javaFiles/MainApplication.java Sed -i '' -e "s/.*package.*/package "$packageName" /". android/app/src/main/javaFiles/MainActivity.java android/app/src/main/javaFiles/Main2Activity.java

android/app/src/main/java/com/MyWebsite/MyAppName sh file, give permission, and then run it from the same folder you run react-native from: rm -rf.

You'll need to modify the packageName you want to use, and add anything else you want to it.
#ANDROID ROOT FOLDER NAMECHANGER CODE#
gradlew clean since it seems like the react-native packager does that automatically anyways.Īnyways, my solution does what Cherniv's does, except I made a bash shell script for it since I'm building multiple apps using one set of code and want to be able to easily change the package name whenever I run my npm scripts.

Two differences: I have a Main2Activity.java in the java folder that I do the same thing to, and I don't bother calling. I have a solution based on answer (works on macOS for me).
