With the gradle build system, you can create different โflavorsโ for your application.
android { ... defaultConfig { ... } signingConfigs { ... } buildTypes { ... } productFlavors { paid { applicationId "donturner.app.paid" versionName "1.0-paid" } free { applicationId "donturner.app.free" versionName "1.0-free" } } }
You can then create additional source folders for these assembly assemblies, which can be used to provide various implementations. For instance. app/src/free/java/ClassWithDifferences.java will provide a "free" implementation of app/src/paid/java/ClassWithDifferences.java .
Note: the code in app/src/main/ is shared between all tastes; therefore there should not be app/src/main/java/ClassWithDifferences.java . And be sure to use these flavors correctly, for example. a class that exists only in a free taste should not be mentioned in the main and should not be paid.
source share