Skandh Gupta

Skandh Gupta started this conversation 3 months ago.

How to change package name in Flutter?

What steps must be followed to change the application launcher icon in a Flutter project, and what are the considerations to keep in mind for different platforms?

Skandh Gupta

Posted 3 months ago

Changing the package name in a Flutter project involves updating several files and configurations. Here's a step-by-step guide:

Android:

Update android/app/build.gradle: Find the applicationId under the defaultConfig section and change it to your new package name.

Update android/app/src/main/AndroidManifest.xml: Replace the old package name in the package attribute of the manifest tag.

Rename Java/Kotlin Directories: Navigate to android/app/src/main/java/ and rename the directories to match the new package name.

iOS:

Update ios/Runner.xcodeproj/project.pbxproj: Search for the old package name and replace it with the new one.

Update ios/Runner/Info.plist: Change the CFBundleIdentifier to the new package name.

Flutter:

Update pubspec.yaml: Ensure all dependencies are aligned with the new package name if needed.

Rebuild the Project: Run flutter clean and then flutter pub get to refresh the project.