Creating Two APKs From One Android Source Tree

I have an Android app that downloads and analyzes some data from an internet source. Nothing special here. But I need an application for two difference sources, with a little different source code. There are currently two applications in AndroidManifest and two slightly different Activites that override a large abstract class containing all such things. This works without problems, I get two applications, as expected.

Now I want to build two APKs to upload them to the market, each of which must contain one of the applications, and each of the applications must be different for installation (and even in both cases at the same time). The only solution that occurred to me was to create two new projects (with two new AndroidManifest) and symbolize the source source folder for two new projects. However, this also leads to problems, since it is forbidden to install two applications that received the same package (from the point of view of the java package "de.dbruhn.app"). See this topic on the mailing list.

Is there a working solution?

Thanks!

+4
source share
1 answer

This is exactly what the library mechanism is for. Make your original project into a library project, and then create two different projects that reference the library project. Each of them will have its own manifest file and can declare its own package name (which will identify it on the Android market) and many declared actions and filters.

Please note that none of the new projects should contain any source code. They can simply refer to actions in the library project (using absolute path names, if necessary to eliminate differences in packages).

+4
source

All Articles