0

I have an application A that consists of feature 1 , feature 2, feature 3. Now I want to create an application B that consists of only feature 1 and application C that consists only of feature 3.

Things I have tried

I have organized the packages according to features. Now maintaining Application A, B and C as separated projects will lead to duplication of efforts.

Android Studio

Using Android Studio I have created "Variants". I am able to get Application A, B and C as apks but size of all the apk is same i.e they contain all the code of complete project. I want Application A, B and C such that it only consists code relevant to there feature. Excluding packages while building is not supported as can be seen from this link. Am I missing something or is there any other way to customize build script for the applicatoin

Community
  • 1
  • 1

1 Answers1

1

Your best approach would be to separate your features (1-3) into standalone libraries that can be Java or Android library modules. In your Android Studio project, you can have more modules for applications A-C, and have them depend on the feature modules they need.

Maintaining the features as standalone libraries and keeping the different apps separated from them will probably make your code more modular and easier to maintain, so it should help you in that regard as well.

Using flavors in Android Studio to differentiate the application types would make sense if the applications are very similar and will share the majority of their code. Examples would be a free vs. paid version of the same app. If the apps are conceptually different, you'll probably find it better to make them separate app modules.

Scott Barta
  • 79,344
  • 24
  • 180
  • 163
  • Thanks. We have decided to proceed as you mentioned by categorizing features as library files. Android Studio 1.0 looks great. Would we be seeing any enhancements regarding customizing builds in Android Studio soon ? – theHumbleProgrammer Dec 10 '14 at 05:27