10

I have two branches of the same master

version1
version2

I would like to be able to have both versions of the same app installed on my phone at the same time, without them overwriting each-other.

Is it possible?

Thanks

the_prole
  • 8,275
  • 16
  • 78
  • 163
  • install them with different application ids from one another – nandsito Apr 28 '17 at 00:06
  • As you can see from the answers, Android uses the package name as id. This id must be unique, even when you have different versions, for Android the app will be the same. So, you must change the package name so, install different apps representing different versions. Hope it helps. – Walter Palladino Apr 28 '17 at 01:36
  • What you are looking for is called build variants aka product flavors in gradle. Please read **Configure Product Flavors** in https://developer.android.com/studio/build/build-variants.html – Muhammad Babar Apr 28 '17 at 06:19

1 Answers1

8

Yes. It is possible.

Change the package name in your Android manifest or app build.gradle.

Example:

Application version 1

app build gradle:

defaultConfig {
        applicationId "com.example.application.appone"
        ...
              }

manifest file:

<manifest
    package="com.example.application.appone">

Application version 2

app build gradle:

defaultConfig {
        applicationId "com.example.application.apptwo"
        ...
              }

manifest file:

<manifest
    package="com.example.application.apptwo">
ADimaano
  • 396
  • 1
  • 4
  • 2
    @the_prole See https://developer.android.com/studio/build/application-id.html for more details - you can also do this in the same build with variants. One small gotcha - even in different package names, you can't install two content providers with the same ID. If you run into that, there are solutions here: http://stackoverflow.com/q/16777534 – ephemient Apr 28 '17 at 04:17