Switching trial and pro builds with android apps in Eclipse: how to make it less painful?

I have an application for Android which comes in two forms: a trial version and a paid "pro" version. The two versions coexists in Android Market and have different package names (let's call them com.app.trial and com.app.pro). They share the same codebase. When I have to switch between trial and pro builds in Eclispe, I have to spend no less than 20 minutes each time editing the code to make it build the correct version. My procedure looks like this:

  1. Rename package name in AndroidManifest.xml (also rename app versionName, and versionCode).

  2. Click on main package name "com.app.pro" (if pro was the lastest build and now I want to make a trial build) and select Refactor->Rename (check 'Update references' and 'Rename subpackages') and let Eclipse do the renaming.

  3. After this comes the hard part: in my code many files still import the "old" package name, "com.app.pro" instead of being automatically changed to "com.app.trial". In some cases Eclipse adds those references during the renaming, for no apparent reasons (there are no references to this specific package from within a given Java file). I have to manually edit all the instances.

My question is:

How do I make this procedure less time consuming? I also have been using NetBeans where there's a handy support for #ifdefs (aka Abilities) which really makes switching between builds a breeze. Eclipse unfortunately has no support (at least no buil-in support) for #ifdefs.

Any suggestions would be greatly appreciated.

P.S. For the reference I am using Eclipse Ganymede version 3.4.2 but also tried a newer version, it does the same.


A great solution for this is to split your applications into three projects :

  • One library project, that will contain all common code
    • actually, creating two versions (lite and paid) of one application is one of the common scenarios this page is talking about ;-)
  • One project for the trial version,
  • and one project for the pro version.

Each trial and pro version will :

  • Reference the library project (that contains almost all code)
  • Define what is specific to the trial or pro version (like manifest, some strings, some additional code, ...)

With that, building the trial or the pro version is as simple as building one project, or the other : no need to change anything !

A couple of links that might help :

Need Your Help


api rest http http2

Couple of months ago, HTTP/2 has been published as RFC7540 .

How far will Spark RDD cache go?

apache-spark distributed-computing

Say I have three RDD transformation function called on rdd1: