Change Flutter Package Name 2026

Jyotishgher Astrology
By -
0

 Change Flutter Package Name 

The easiest and most reliable method to change your Flutter project's package name (also known as the application ID or bundle ID) is by using a dedicated package, such as the change_app_package_name or rename package. 

Change Flutter Package Name


The old way of running the package (flutter pub run) is deprecated — Flutter now uses dart run instead.

Also, the package needs to be added as a dev_dependency first.

Correct Way to Change Package Name (2026 Updated Method)

Step 1: Add the package to your project

Run this command:

Bash

flutter pub add --dev change_app_package_name

Step 2: Run the rename command using dart run

dart run change_app_package_name:main xx.xxx.xxx


This will:

  • Change applicationId in Android build.gradle
  • Update AndroidManifest.xml
  • Move and update Kotlin/Java files
  • Handle iOS bundle identifier (if iOS project exists)

Step 3: Clean and rebuild

flutter clean flutter pub get flutter run

Method 2: Manual Renaming (Advanced)
If you prefer not to use a package or need more granular control, you can manually update the relevant files. Android:
    • Update the applicationId in android/app/build.gradle within the defaultConfig section.
    • Update the namespace in android/app/build.gradle (or package attribute in AndroidManifest.xml in older projects).
    • Manually refactor the directory structure in android/app/src/main/kotlin or android/app/src/main/java to match the new package name.
    • Perform a global search and replace (Ctrl+Shift+F or Cmd+Shift+F) for the old package name across the entire project to catch all occurrences, including AndroidManifest.xml files in debug and profile folders.
  • iOS:
    • Open the iOS module in Xcode by right-clicking the ios folder and selecting Open in Xcode.
    • In the project navigator, select the Runner project, then the Runner target, and go to the General tab.
    • Update the Bundle Identifier field to your new package name.
    • Alternatively, edit the ios/Runner/Info.plist file and change the CFBundleIdentifier key value. After making manual changes, always run flutter clean and then flutter run to rebuild the project with the new configurations. If using Firebase, remember to update the package name in your Firebase console settings as well. 
Tags:

Post a Comment

0Comments

Post a Comment (0)