How to Change Package Name?
Changing the package name of your Flutter app is essential when you want to publish it with your own branding. Follow these steps:
Android Package Name Change
-
In Android Studio, click on the little gear icon in the Android pane. Go to "Tree Appearance" and then uncheck/deselect the "Compact Middle Packages" option.
-
Your package directory will now be broken up into individual directories.
-
Individually select each directory you want to rename:
- Right-click on it
- Select "Refactor"
- Click on "Rename current"
- In the pop-up dialog, enter the new name
-
Enter the new name and hit "Refactor". Allow a minute to let Android Studio update all changes.
-
Now search and replace
YOUR_PACKAGE_NAME_HERE
with your new package name in all files.
iOS Bundle Identifier Change
For iOS, you need to update the Bundle Identifier in Xcode:
- Open your Flutter project's iOS module in Xcode
- Select the Runner project in the Project Navigator
- Select the Runner target
- In the General tab, update the Bundle Identifier field with your new package name
Make sure the Bundle Identifier matches the one you've registered in your Apple Developer account if you're planning to publish to the App Store.
After changing the package name, you'll need to update any references to the old package name in your code, particularly in AndroidManifest.xml and any plugins that might be using the package name.