0

I need to temporarily change the package name of an Android app.

The reason I need to do this is because my customer does not yet have a Google Play account, but wants to test the app I've been developing for him. So I want to put it on an internal testing channel using my Play account, but I want to do so under a different package name.

When I develop iOS apps, there is a mechanism in Xcode by which any app can have multiple targets, and each target can have a separate bundle ID, and other properties, creating a unique app from the same source code. Then I can switch between targets at will to produce either version of the app.

What is the correct way to do this in Android?

The answers I've found online suggest that a wholesale refactoring of all the package names in the actual source code files is necessary -- I don't think this is the right answer in my case. I just want to toggle between two package names the same way you would toggle between build variants.

Thanks, Frank

Flarosa
  • 1,287
  • 1
  • 13
  • 27
  • Set up a new product flavor with a different `applicationId` value. – CommonsWare Nov 08 '21 at 19:35
  • Maybe create a different product flavor, Frank. You can have different package names for two flavors for an app, and upload a generated APK of one of the flavors to your account. – viv3k Nov 08 '21 at 19:37
  • https://stackoverflow.com/questions/39552590 – viv3k Nov 08 '21 at 19:37
  • Thanks for the tips. Is a product flavor the same thing as a build type? I know about build types, but I have never heard of flavors. – Flarosa Nov 08 '21 at 19:42

1 Answers1

1

Use applicationIdSuffix ".demo" to extend the given name (the namespace does not really matter, the package name only has to be unique). One probably cannot completly override the applicationId; the merge output of AndroidManifest.xml would show what is broken.

Better publish to Firebase App Distribution first (can be linked to Play Store).
There the obstacles are generally lower - and one can also see remote crashes.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • `Better publish to Firebase App Distribution first ` will this still go through the same process of needing your app to be reviewed by the playstore first ? doesn't seem like it ? – a_local_nobody Nov 08 '21 at 19:53
  • Not at all; one can simply upload signed debug or release builds and notify testers by email; there's also an "App Tester" app, which can be used to download and install the packages. Besides, everything can be automated by Gradle plugin. It's probably the better alternative, compared to creating "never to be deleted again" packages names on Google Play - in the end one will have to upload R8 mapping files anyway (also something that plugin does). – Martin Zeitler Nov 08 '21 at 22:25
  • sounds like a nice alternative then, it's basically internal app sharing but without the need of already having the app on the store ? – a_local_nobody Nov 08 '21 at 22:27