Install two versions of the same app on one device

I need to install two different versions of the same app on my device in order to run some tests. I know it is possible to change the package, but also, I read that it can do it by changing the Manifest and Gradle with the ApplicationID. How can i do this? Thanks to

+4


source to share


2 answers


This answer on android stackexchange suggests that you can do this by changing the name package

in manifest.xml

.



<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.original.oldversion">

      

+2


source


The best way to achieve this is using gradle.
You can define 2 flavors , something like:

productFlavors {
    flavor1 {
        applicationId "com.example.flavor1"
    }
    flavor2 {
        applicationId "com.example.flavor2"
    }
}

      

Note to do this with manifest as gradle overrides this file.



You can also define a suffix.
Something like that:

android {
    defaultConfig {
        applicationId "com.example.myapp"
    }
    productFlavors {
        flavor1 {
            applicationIdSuffix ".flavor1"
        }
        flavor2 {
            applicationIdSuffix ".flavor2"
        }
    }
}

      

+2


source







All Articles