I have 3 flavors.
flavor1
flavor2
flavor3
and MainActivity for all flavors. I want the same implementation for flavor1 and flavor2 and different for flavor3. If i add separate MainActivity in flavor3/java/com/sample/MainActivity it show "Duplicate class found in the file" and the folder structure is following.
main/java/com/sample/MainActivity
flavor1
flavor2
flavor3/java/com/sample/MainActivity
Do I need to add the MainActivity in all flavors?
Like :
main/
flavor1/java/com/sample/MainActivity
flavor2/java/com/sample/MainActivity
flavor3/java/com/sample/MainActivity
But doing this every time I have to update when change in flavor1 and make that change in flavor2. is there any solution?
Yes.
Have
MainActivitybe as small as possible, delegating to other classes as needed. So, theflavor1andflavor2implementations ofMainActivitymight delegate to some other class that resides inmain, while theflavor3implementation ofMainActivitydoes something else.