Changing "package ID" after initial "ionic capacitor copy"

What is the right process to follow when it’s time to set the final value of our app’s package ID? What are all the places where it needs to be changed under the already-existing “ios” and “android” folders in our Ionic app’s folder hierarchy? We’re at the point where we’re going to start uploading builds to the Apple / Google portals, so this needs to be “right.”

I’ve read these documents multiple times:

There’s very little in them about how to manage the “package ID” (a.k.a. bundle ID or application ID). There’s an implication that if I change the value in capacitor.config.json that it will make all the required changes for iOS and Android the next time I run “ionic capacitor sync”. But that doesn’t seem to be happening. For android, build.gradle and AndroidManifest.xml still have the default “io.ionic.starter” value.

Is this something that has to be managed manually once the initial “ionic capacitor copy” commands have been run? Or perhaps there’s someplace that explains the difference between “ionic capacitor copy” and “ionic capacitor sync” (the latter is what we’ve been using). (I’ve run each and don’t see differences in their effects.)

The apparent lack of documentation on something so fundamental to how mobile apps exist within the vendor portals / stores is surprising and frustrating.

Thanks.

First update appId in your capacitor.config.ts file. Then, if you are using VS Code, use the Ionic Extension - Configuration -> Properties -> Bundle Id.

If doing it manually, for Android, see Change application name on android platform - #2 by twestrick

For iOS, I believe it is just the PRODUCT_BUNDLE_IDENTIFIER (two places) in ios/App/App.xcodeproj/project.pbxproj.

Thanks for the prompt reply - very helpful. For iOS, I also think that it needs to be changed in Info.plist - maybe that’s applicable because we’re registering a custom URL.

In the other issue that you link to, you mention changing “android:name” in AndroidManifest.xml. Though it’s called “name”, it’s actually a fully-qualified Java classname. Which is why you point out that a new folder needs to be created and the package name in MainActivity.java needs to be changed.

How important is that? Is that just to achieve some level of consistency regarding the package ID vs. the entry point to the Android app? Or will things not work if you don’t also change android:name and MainActivity.java?

Thanks again.

From my limited Android experience, my guess is that it would work just fine without renaming the namespace/classname for Android. For consistency though, why wouldn’t you want to change it :grin:

The pedantic part of me absolutely wants to make that change. The pragmatic side of me says: Do I really want to mess with source files that I don’t “own”?

Thanks again for the responses. Very helpful.