Install two apks of different versions of applicat

2019-07-27 09:48发布

问题:

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?

回答1:

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

OUTPUT

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



回答2:

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.



回答3:

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.



标签: android adb