In react-native, To create a new application we use the following command:
react-native init MyApp
This command will create a package name with com.myapp. Sometimes, if your application is created with the wrong package name or bundle id or you want to release your existing application with a different package name then you can change your package name by following the below steps. So, if you want to change your package name then you need to do some changes in the following files:
Android
android/app/src/main/java/MY/APP/NEW_ID/MainActivity.java:
package MY.APP.NEW_ID;
android/app/src/main/java/MY/APP/NEW_ID/MainApplication.java:
package MY.APP.NEW_ID;
android/app/src/main/AndroidManifest.xml:
package="MY.APP.NEW_ID"
android/app/build.gradle:
applicationId "MY.APP.NEW_ID"
android/app/BUCK:
android_build_config( package="MY.APP.NEW_ID" ) android_resource( package="MY.APP.NEW_ID" )
In end clean gradle (in /android folder):
./gradlew clean
iOS
./ios/APPLICATION_NAME/info.plist :
<dict>
...
<key>CFBundleDisplayName</key>
<string>APPLICATION_NAME</string>
<key>CFBundleIdentifier</key>
<string>IOS_BUNDLE_ID</string>
...
</dict>
Clean your project after changes.