Learn how to create different versions of your App like Free and Paid

Android framework makes it quite easy for you to generate different flavors and variants of your App. Like you can create a free version or a paid version of your App.

In order to do this you need to follow these steps:

You need to specify the variants or flavors in your App’s build.gradle file.

Like

productFlavors {
    demo {
        applicationId "com.edocent.demo"
        versionName "1.0-demo"
    }
    full {
        applicationId "com.edocent.full"
        versionName "1.0-full"
    }
}

In all likelihood your Free App version will need a different Activity compared to the Paid one. So you need to create different folders for the two flavors.

So go to the Project->src folder and create a new Java Folder – free.

Create another one for paid similarly.

Add appropriate Activity and other files to this folder.

And you are all set. Execute Generate Signed APK task from the Build option. This will ask you which flavor you need the APK for.

Cool isn’t it.

Source code is available here