I have an Android app that's downloaded primarily from Android Market (now, Google Play). We made a few tweaks to the source and also submitted to the Amazon App Store to see what sort of traction it gets. I'm now looking for a sustainable way to develop from a common code base and yet build so that I can submit to either/both.

Amazon's store has some restrictions about available APIs, and hence I'd like to conditionally remove/modify features from that version. Since Java doesn't support traditional conditional compilation, and conditionally including files in Eclipse doesn't seem trivial (is it even possible?), I wanted to ask what others are doing to solve this.

Admittedly, I'm no Eclipse/Java expert so feel free to school me.

What I'm looking for in a solution:

  • Building/debugging using Eclipse.
  • Static code files, with environment/settings toggles to control what to build.
  • No duplicate code or conditional logic in code to pick code flow at runtime

Is this something you've solved for Android apps specifically, or for other Java/Eclipse based projects? Suggestions for where to begin?

Edit
Report