So I tried to rename my App and I used the npm install react-native-rename -g - package
(https://github.com/junedomingo/react-native-rename) but I noticed that there are about 200 files that still have the old name in it.
My question is how do you guys update your RN projectnames? Can I also rename the folder that the project is in or will something crash?
I am really looking for a solution ( or an approach ) to rename everything that was named for ex. "myApp" to "myCoolApp". Do I need to go in every file and rename it by myself - would the app still work ?
Thanks :rocket:
-To Rename the Android App Package Name , follow the below instructions:
Modify the following files and rename the package name:
settings.gradlemainActivity.javamainApplication.javaAndroidManifest.xmlandroid/app/build.gradlegoogle-services.jsonsplashActivity.javapackage.jsonBUCK file.project
Note: - Rename the folder name `/android/app/src/main/java/com/oldpackagename` to `/android/app/src/main/java/com/newpackagename`
Delete the package-lock.json and Reinstall the node modules
cd androidgradlew cleancd ..react-native run-androidFor Android:
Manually change it in android/app/src/main/java/com/PROJECT_NAME/MainActivity.java: package MY.APP.ID;
In android/app/src/main/java/com/PROJECT_NAME/MainApplication.java: package MY.APP.ID;
In android/app/src/main/AndroidManifest.xml: package="MY.APP.ID"
In android/app/build.gradle: applicationId "MY.APP.ID"
rename app/src/main/java/com/OLD_PROJECT_NAME/ to app/src/main/java/BUNDLE_PREFIX/PROJECT_NAME/?BUNDLE_SUFFIX/
Gradle' cleaning in the end (in /android folder): ./gradlew clean
For iOS:
Change the Bundle Id in Xcode.
try this too. Here you can find every thing regarding name changing.
https://www.youtube.com/watch?v=xqUqi3lqLHw
@Santu1245 instruction is working fine but one file is missing that is app.json file. Please rename newpackagename in app.json file to avoid error like "newpackagename has not been registered" from AppRegistry.js file.
Thanks @Santu1245
Full instruction as below:
Modify the following files and rename the package name:
settings.gradle
mainActivity.java
mainApplication.java
AndroidManifest.xml
android/app/build.gradle
google-services.json
splashActivity.java
package.json
BUCK file
app.json
Rename the folder name /android/app/src/main/java/com/oldpackagename to /android/app/src/main/java/com/newpackagename
Delete the node modules and Reinstall the node modules
and then run the below command:
cd android
gradlew clean
cd ..
react-native run-android
For ios I changed the bundle ID and now I'm getting the following error.
app/ios/build/app/Build/Products/Debug-iphonesimulator/app.app/PlugIns/appTests.xctest/appTests normal x86_64
This would be good if this can be added as a feature in react-native's CLI, right? I found this https://github.com/junedomingo/react-native-rename#readme but seems to be not being maintained anymore.
This would be good if this can be added as a feature in react-native's CLI, right? I found this https://github.com/junedomingo/react-native-rename#readme but seems to be not being maintained anymore.
This package is buggy.
Most helpful comment
-To Rename the Android App Package Name , follow the below instructions:
Modify the following files and rename the package name:
settings.gradlemainActivity.javamainApplication.javaAndroidManifest.xmlandroid/app/build.gradlegoogle-services.jsonsplashActivity.javapackage.jsonBUCK file.projectDelete the package-lock.json and Reinstall the node modules
cd androidgradlew cleancd ..react-native run-android