The easiest way to implement this is through build.gradle in Android Studio. Read about productFlavors . Add the following lines to build.gradle:
productFlavors { lite { packageName = 'com.project.test.app' versionCode 1 versionName '1.0.0' } pro { packageName = 'com.project.testpro.app' versionCode 1 versionName '1.0.0' } }
In this example, I added two types of applications: the lite version and the pro version. Each version has its own versionCode and versionName (for publication on Google Play).
And in the code, you can set separate logic by checking the variable BuildConfig.FLAVOR:
if (BuildConfig.FLAVOR == "lite") { // ΠΊΠΎΠ΄ ΠΎΡΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ ΡΠ΅ΠΊΠ»Π°ΠΌΡ ΠΈΠ»ΠΈ ΠΏΡΠΎΡΠΈΠ΅ ΠΎΠ³ΡΠ°Π½ΠΈΡΠ΅Π½ΠΈΡ ΡΡΠ½ΠΊΡΠΈΠΎΠ½Π°Π»Π° }
To launch and test various application logic options on the device, simply change the type of the application being launched on the "Build Variants" tab in Android Studio. The Build Variants list is automatically generated based on the productFlavors specified in build.gradle:
