Flavor is an amazing solution for creating different variations of the same application with separate functions.
Specific files
Let's say that one of your actions will have different functionality and user interface, then you can avoid saving this activity in a common package and move on to the appropriate taste. Each flavor can have a separate java and res folder along with a manifest (which is optional, Studio takes care of itself). This is where your specific Activity java file and xml file should be placed.
Example: the login screen will have different interfaces and functions in each flavor
Now at runtime, as well as compilation time, Android Studio switches between packages and selects the appropriate files. This is done using the Build Variant function.

Shared files
Thus, access to shared files that are applicable is all tastes, let it be in main/java and main/res itself.
Ideally, depending on your fragrance numbers, bundle.gradle would look something like this.
productFlavors { student { applicationId "com.abc.student" } staff { applicationId "com.abc.staff" } tempstaff { applicationId "com.abc.tempstaff" } } sourceSets { tempstaff { manifest.srcFile 'src/tempstaff/AndroidManifest.xml' } student{ manifest.srcFile 'src/student/AndroidManifest.xml' } staff { manifest.srcFile 'src/staff/AndroidManifest.xml' } }
Now, to complete the answer, the files common to all the application will remain in the main package. Specific files applicable to the individual taste will be included in this flavor. This means flavors may have additional activity / features that are not part of others, including basic ones as well.
Follow this link for more information.
source share