Sub topic 3
Setting the application ID, bundle identifier, and app name
This chapter assumes you can build a debug app with flutter run and that you have opened the android and ios folders before. You do not need to know Gradle or Xcode well. Every edit is shown in full.
A Flutter app carries three kinds of names. Two of them are identifiers that the stores and operating systems use to tell your app apart from every other app. The third is the label users see under the icon. Setting all three correctly before your first upload saves you from problems that are hard or impossible to undo later.
The three names and where they live
| Name | Platform | Purpose | Where you set it |
|---|---|---|---|
| Application ID | Android | Unique identity on the device and in Google Play | `applicationId` in `android/app/build.gradle.kts` |
| Bundle identifier | iOS | Unique identity on the device and in App Store Connect | `PRODUCT_BUNDLE_IDENTIFIER` in Xcode |
| Display name | Both | Text shown under the home screen icon | `android:label` in the manifest, `CFBundleDisplayName` in `Info.plist` |
The Dart package name in pubspec.yaml (name: my_app) is a separate thing. It controls Dart imports only. Changing it does not change what the stores see.
Choosing an identifier
Both platforms use reverse-domain notation. You take a domain you control, reverse it, and add the app name. If you own acme.dev, a notes app becomes dev.acme.notes. If you have no domain, pick a prefix that is unlikely to collide, such as io.github.yourname.notes.
Never ship with com.example.*. Google Play rejects it, and it is the default Flutter generates.
The two platforms accept different characters:
| Rule | Android application ID | iOS bundle identifier |
|---|---|---|
| Segments | At least two, separated by dots | Dot-separated, reverse-domain by convention |
| Allowed characters | Letters, digits, underscores | Letters, digits, hyphens, dots |
| Segment start | Must begin with a letter | Not enforced in the same way, but start with a letter |
| Hyphens | Not allowed | Allowed |
| Underscores | Allowed | Not allowed |
| Case | Case-sensitive, lowercase by convention | Case-insensitive in practice, lowercase by convention |
If you want the same identifier on both platforms, which makes analytics and support simpler, use only lowercase letters and digits. dev.acme.notes works on both.
The identifiers do not have to match. Some teams keep them different on purpose when an older app already holds one of them.
Setting the Android application ID
Open android/app/build.gradle.kts. Two settings look similar and do different jobs.
// android/app/build.gradle.kts
android {
namespace = "dev.acme.notes"
defaultConfig {
applicationId = "dev.acme.notes"
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
}applicationIdis the identity of the installed app. Google Play, the device, andadball use it.namespaceis a build-time setting. Android Gradle Plugin uses it as the package for generated classes such asRandBuildConfig, and to resolve relative class names in the manifest.
The two can differ. If you only change applicationId, your Kotlin code can stay in its original package and the app builds fine. If you change namespace, you must also move MainActivity into a matching directory and update its package line. Otherwise the manifest entry android:name=".MainActivity" points at a class that does not exist, and the app crashes on launch with ClassNotFoundException.
For a first release, the least risky approach is to change applicationId and leave namespace alone. Change both only if you want the source tree to match the final name, and then verify with a clean build.
Side-by-side debug installs with a suffix
You can give debug builds their own identity so they install next to the release app:
// android/app/build.gradle.kts
android {
buildTypes {
debug {
applicationIdSuffix = ".debug"
}
}
}A debug build then installs as dev.acme.notes.debug. This is useful for testers who keep the store version on the same phone. Be aware that services keyed to the application ID, such as Firebase configuration or Google Sign-In credentials, need an entry for the suffixed ID too.
Setting the iOS bundle identifier
The bundle identifier lives in the Xcode project, not in a file you would normally edit by hand. To change it:
- Run
open ios/Runner.xcworkspace. Open the.xcworkspace, not the.xcodeproj, so that CocoaPods dependencies load. - Select Runner in the project navigator, then the Runner target.
- Open Signing & Capabilities, or General, and edit Bundle Identifier.
Xcode writes the value to ios/Runner.xcodeproj/project.pbxproj as PRODUCT_BUNDLE_IDENTIFIER. You can confirm the change from the terminal:
grep PRODUCT_BUNDLE_IDENTIFIER ios/Runner.xcodeproj/project.pbxprojYou will see several lines. The Runner target appears once per build configuration (Debug, Release, Profile). The RunnerTests target has its own entry, usually the app ID plus .RunnerTests. If you edit the file by hand, change all of them consistently.
The bundle identifier is also what you register as an App ID in your Apple Developer account, and it must match the app record you create in App Store Connect. A mismatch produces signing errors that the later chapters on iOS signing cover in detail.
Setting the display name
The display name is what appears under the icon. It can contain spaces and mixed case, and it is not unique across the store.
On Android, edit android/app/src/main/AndroidManifest.xml:
<application
android:label="Acme Notes"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">On iOS, edit ios/Runner/Info.plist:
<key>CFBundleDisplayName</key>
<string>Acme Notes</string>
<key>CFBundleName</key>
<string>notes</string>CFBundleDisplayName is the name shown on the home screen. CFBundleName is a short internal name, and iOS falls back to it only if there is no display name. If CFBundleDisplayName is missing from your plist, add it.
Keep the label short. Home screens truncate long names, typically around 12 characters on iOS, and Android launchers vary. A name that is cut off to "Acme Notes Pr…" looks unfinished. You can still use a longer name for the store listing, which you set separately in each console.
If you want the name localized, for example "Notizen" in German, use strings.xml per locale on Android and InfoPlist.strings per locale on iOS. That is beyond what a first release needs.
Verifying what you built
Do not trust the source files alone. Check the built artifact.
For Android, build an APK and inspect it with aapt2, which ships in the Android SDK build-tools:
flutter build apk --release
aapt2 dump badging build/app/outputs/flutter-apk/app-release.apk | head -n 5The output includes package: name='dev.acme.notes' and an application-label line. If either is wrong, the fix is in the Gradle or manifest files above.
For iOS, run the app on a device or simulator and check the home screen label. For an archive, Xcode's Organizer shows the bundle identifier when you validate it.
Common errors
- Stuck on
com.example. Play Console refuses the upload. ChangeapplicationIdbefore the first upload. - Renamed after publishing. On Android the application ID cannot change for an existing Play listing. A new ID means a new app, with no update path for existing users and no ratings carried over. Treat the ID as permanent once you upload to any Play track.
- Mismatched
namespaceand class location. The app builds and then crashes at launch. MoveMainActivityto match, or revertnamespace. - Bundle ID not registered. Xcode reports that no provisioning profile matches the bundle identifier. Register the App ID in the developer portal, or let Xcode's automatic signing create it.
- Third-party config files still point at the old ID.
google-services.jsonandGoogleService-Info.plistcarry the identifier. Regenerate them after any rename. - Display name changed in only one place. The Android and iOS labels are independent, so update both.
Exercise
Your app's source tree uses the package com.example.old, and applicationId is com.example.old. You change only applicationId to dev.acme.notes and build. Will the app still launch, and why? What would break if you also changed namespace to dev.acme.notes without moving any files?
Show answer
It still launches. applicationId is only the installed identity, while namespace determines the package used to resolve .MainActivity in the manifest, and that is unchanged. If you change namespace without moving MainActivity into a dev/acme/notes directory with a matching package line, the manifest resolves to dev.acme.notes.MainActivity, which does not exist, so the app crashes at launch with a ClassNotFoundException.
Exercise
A teammate proposes dev.acme.my_notes as one identifier for both Android and iOS. Does it work on both platforms? Suggest a safer value.
Show answer
It fails on iOS, because bundle identifiers allow letters, digits, hyphens, and dots but not underscores. It is valid on Android, which allows underscores. Use dev.acme.mynotes, which contains only lowercase letters, digits, and dots and is valid on both.