Keep all common classes in top flavor. For example, you have three flavors: cat, dog and bicycle. In these three flavors, Cat and Dog are basically the same, except for a few. On the other hand, Bike also has some Classes that are common.
Three scenarios:
01. When all the flavors have common functionality
It seems that Cat, Dog and Bike have one class called PriceInformation. Then save this class in the main flavor.
02. When Cat and Dog have the same functionality, but Bike does not.
Like, Cat and Dog have a common functionality called LifeSpan, then save this class only in this flavor.
03. When only a bicycle has common functionality, but the other two options do not.
Then save this particular class only in Bike Flavor.
apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { applicationId "com.productflavor" minSdkVersion 14 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } productFlavors { cat { applicationId "com.cat.theme" } dog { applicationId "com.dog.theme" } bike { applicationId "com.bike.theme" } } }

Since MainActivity is common, then only the main flavor is mentioned.
source share