0

I know this has been asked before but I haven't seen a working solution. I have two android studio (V 3.1.3) projects, MyAppBasic and MyAppPro. They each have 3 modules in common and one that is unique. My current implementation is duplicating the 3 common modules in each project. Obviously this is undesirable. What is the recommended way to implement these two apps and avoid code duplication? Thanks.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Phil O
  • 1,588
  • 4
  • 28
  • 52

1 Answers1

1

In case both of your project: MyAppBasic and MyAppPro, have almost a similar code, you can merge them and use build variant to differentiate between basic and pro app.

You also need to installing each module as a local library by using Gradle Android Maven plugin (you can see this answer for details: https://stackoverflow.com/a/33736043/4758255). Then you only need to maintain 3 common modules which is reusable as the libraries for both of your projects.

ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96