Change the Package Name
Give each app your own package name (Android) and bundle ID (iOS) before you connect Firebase and publish.
Google Play, the App Store and Firebase know each app by its package name. Pick your own, for example:
| App | Folder | Now | Yours, for example |
|---|---|---|---|
| Customer | customer/ |
com.zipkart.customer |
com.yourbrand.customer |
| Store | store/ |
com.zipkart.store |
com.yourbrand.store |
| Delivery Boy | driver/ |
com.zipkart.driver |
com.yourbrand.driver |
It can never change after you publish
Once an app is live on Google Play or the App Store, its package name is fixed. Choose carefully, and use a different one for each app.
Android#
Open android/app/build.gradle.kts in the app folder and change one line:
defaultConfig {
applicationId = "com.yourbrand.customer"
...
}
That is all Google Play and Firebase need.
Optional: also change the namespace
The same file has namespace = "com.zipkart.customer". Users never see it, so you can leave it. To change it, change these three together, or the app crashes on start:
namespace = "com.yourbrand.customer"inandroid/app/build.gradle.kts.- Move
MainActivity.ktfromandroid/app/src/main/kotlin/com/zipkart/customer/to.../com/yourbrand/customer/. - Change the first line of
MainActivity.kttopackage com.yourbrand.customer. Change nothing else in that file.
iOS#
- Open
ios/Runner.xcworkspacein Xcode. - Click Runner → target Runner → Signing & Capabilities.
- Set Bundle Identifier to your own (check the All tab so Debug, Release and Profile change).
- Select the RunnerTests target and set the same ID with
.RunnerTestsat the end.
In ios/Runner.xcodeproj/project.pbxproj, replace every PRODUCT_BUNDLE_IDENTIFIER = com.zipkart.customer with your own ID (three lines for Runner, three for RunnerTests).
Do not change the Dart package name
The name: line in pubspec.yaml (zipkart_customer, zipkart_store, zipkart_driver) is used in every import in the code. Users never see it. Leave it as it is.
Next
Now connect each app to your Firebase project with FlutterFire. If you change a package name after that, run FlutterFire again for that app.