jimdoesnotgym
jimdoesnotgym

Reputation: 87

Install two apks of different versions of application

I have two versions of the same Android application that I would like to have simultaneously on my Android device for easier testing. Is there a way to install both apk files such that they coexist on the same device?

Upvotes: 1

Views: 6240

Answers (3)

Muhammed Refaat
Muhammed Refaat

Reputation: 9103

Simple & Easy, just change the application id from build.gradle(app) and change the package name attribute from manifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.netaq.schoolvoicedemo"
.
.
.
</manifest>

And to avoid duplicate permissions, make sure you don't have any signature permissions in your app manifest, for example:

<permission
    android:name="com.myapp.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.myapp.permission.C2D_MESSAGE" />

has to be renamed to:

<permission
        android:name="com.myappsecondversion.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

<uses-permission android:name="com.myappsecondversion.permission.C2D_MESSAGE" />

Now you have a completely new application.

Upvotes: 1

jagapathi
jagapathi

Reputation: 1645

use product flavours

productFlavors {
dev {
    applicationIdSuffix ".dev"
    versionCode 1
    versionName '1.0.0'
}
pro {
    applicationIdSuffix ".pro"
    versionCode 1
    versionName '1.0.0'
 }
}

BUILDING APK

Click on gradle on right side of android studio

app --> tasks --> build --> assemble

enter image description here

OUTPUT

generated at --> app --> build --> outputs --> apk

Upvotes: 5

Ranjan
Ranjan

Reputation: 400

You can create a new user in your device and install another instance of the app in that user.

Or

You can download Parallel Space from play store and run multiple instance or installation of an application.

Upvotes: 0

Related Questions