Question

This is more of a fundamental question I suppose. I currently have in the market one app that I have separated in two projects. One project (with it's unique package name, obviously) does not have Google Ads and is not free. The other project has Google Ads and it's free.

Both projects are exactly the same. Same functionalities.

When I want to add a new functionality, I have to work on both projects, making then the release of my app slower, since I am basically control-c/control-v what I did in one project onto another. And sometimes I just forget something, so I have to fix the issues...

So, basically, I am wondering if there's a better way I have to manage that?

Maybe creating a rather intelligent script that will build the application depending on what I want (i.e: if it's ad based version, should use the AndroidManifest that declares the AdMob Activity)

Or maybe create a library? But I don't think this approach would work.

Looking forward for inputs.

Regards,

Felipe Caldas

Was it helpful?

Solution

Yes, a library project is exactly what you want. Put all the functionality in a library, and have two very thin shells for each of your app types that make calls into the library. As you noticed, duplicating the code is error prone and at best just extra work you shouldn't have to do.

See: Managing Projects for details. That page even mentions your exact scenario:

If you are creating an application that exists in both free and paid versions. You move the part of the application that is common to both versions into a library project. The two dependent projects, with their different package names, will reference the library project and provide only the difference between the two application versions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top