user3300845
user3300845

Reputation: 127

How to build 2 apps with the same project in android studio?

I've recently just imported my eclipse project into Android Studio, I haven't convert it into gradle yet. So some forum that offers me solution from gradle is not working. My problem is I have 2 application, where both has some slight difference. I want to use the same project when I deploy the application. I've tried to change the project name but that doesn't help. The moment the new application is installed, the previous version is overwritten. I thought of making some changes to the Manifest file(not sure if this is the right thing to do) but in android studio, I can't seem to locate where the file is. Please help.

Regards, Dexter

Upvotes: 3

Views: 2199

Answers (2)

NaviRamyle
NaviRamyle

Reputation: 4007

Use flavors on your build.gradle

productFlavors {
        flavorName {
            minSdkVersion 19
            applicationId 'you.package.name'
            targetSdkVersion 23
            versionCode 1
            versionName 'version_name'
        }
    }

Also you can modify a file with different changes by just adding a source folder for the flavor.

app
|--src
  |--main
  |--flavorName

Upvotes: 1

miva2
miva2

Reputation: 2151

Your application needs to have a different package name for it to be treated as a different app.

So instead of

com.yourcompany.apps.yourapp

You write com.yourcompany.apps.yourapp1 and com.yourcompany.apps.yourapp2

You can do that in your AndroidManifest.XML in the manifest tag

package="com.yourcompany.apps.yourapp1" 

Also, instead of 2 separate apps, try seeing if you can solve this using Build variants and product flavors.

Upvotes: 1

Related Questions