Ofek Ron
Ofek Ron

Reputation: 8580

How to create two diffrent apps from same android source code

I want to create 2 diffrent versions of my app so that both of them can reside on the same device, i need to somehow trick the apk installer that it would think that those apps are not the same and will let me install both of them at the same time.

How can it be done?

Upvotes: 1

Views: 178

Answers (2)

Jivy
Jivy

Reputation: 1213

You can use Gradle to build and manage dependancies. You can create flavours of your application (differents versions with differents configurations for exemple).

In your build.gradle :

android {
    defaultConfig {
        minSdkVersion 8
        versionCode 10
    }

    productFlavors {
        flavor1 {
            packageName "com.example.flavor1"
            versionCode 20
        }

        flavor2 {
            packageName "com.example.flavor2"
            minSdkVersion 14
        }
    }
}

More informations : http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants

Upvotes: 0

mah
mah

Reputation: 39797

You must change the package name in the AndroidManifest.xml of one of the apps; this is the key Android uses to identify an application.

While it's possible to modify the manifest of an APK after it's been built, it's not always reliable.

Upvotes: 1

Related Questions