3. Changing the package name (also known as the bundle identifier or application ID) in a Flutter project involves a few steps:
3.1. Change the Android package name
- Navigate to the
androiddirectory within your Flutter project. - Open the
AndroidManifest.xmlfile located inapp/src/main. - Find the
packageattribute in the<manifest>tag and change its
value to your desired package name.
3.2. Change the iOS bundle identifier
- Open
ios/Runner.xcodeprojusing Xcode. - Select the Runner project → Runner target → General tab.
- Change the Bundle Identifier field to your desired bundle identifier.
3.3. Update Flutter project configuration
- Open
pubspec.yamlin the project root and update thenamefield. - Update the
android: packagefield underflutter:with your new package name.
3.4. Update source code references
Update MainActivity.java/kt (Android) and AppDelegate.swift (iOS) references to the old package name, then clean and rebuild the project.
