I’m trying to create two android applications that has common code (about 80% shared code), so I was documenting myself on Gradle Flavor and multiproject (modules).
Restrictions on project:
-
App-A
andApp-B
depends onmain
-
App-A
andApp-B
doesn’t know about each other. -
App-A
will have some feature that doesn’t exist onApp-B
andmain
-
App-B
will have some feature that doesn’t exist onApp-A
andmain
-
App-A
andApp-B
will have their ownAndroidManifest.xml
I’m trying to use MVP design pattern as well, I don’t know if it’ll have any incidence on the project.
I was thinking of using an architecture that would look like this.
|--- Main
|--- src
|--- main
| |--- java
|--- App-A
|--- src
|--- main
| |--- java // For specific code
|--- App-B
|--- src
|--- main
| |--- java // For specific code
Use Case:
For example, I need to add a feature on MainActivity
of AppA
. Can I just extend/implement a class/interface on App-A to add this feature or do I have to copy everything from MainActivity
of main
?
I saw some advice about using BuildConfig.FLAVOR
as it is available and can do the distinction between flavor, however I’ve noticed by reverse engineering a sample I made that it creates both MainActivity.
Should I be worried about the size of my APK getting much bigger by using flavor ?
What would you recommend me to do ?