[UPDATE 12/30/11: This post is a little out of date, I recently updated to r16 of the ADK, and eclipse 'Indigo' (3.7). I had to play around with the library settings to make the dex process happy, and the settings actually make a little more sense now. I'll make a new post]
Sorry for the long title, but I spent a frustratingly long time( hours ) doing something that should have been achievable in seconds. My hopes are that I am able to document the steps needed here well enough that someone can save themselves some time.
As a last step before publishing, I needed to be able to quickly make two versions of Sedition, an Ad-supported version, and an Ad-free, paid version. In the Android market applications are distinguished from one another by the "package" property in your AndroidManifest.xml file. So simple, change your manifest name and re-build. Not so fast, the resources in your application, eg the files that get assigned an id in the infamous "R" class, are built to live in that class. So when you change your package, any code that references anything in your R class will break. For me this resulted in over 100 errors. I have some final static variables in that help me define code behavior for any given flavor of build. This was the closest I ever got to a #ifdef type mechanism that I mentioned a few months ago. Unfortunately, there is no solution for changing manifest files in a similar manner.
The conventional wisdom of the Web suggests moving your application into an android library, then make two new "Applications" that then link to the library, like so:
This is what I did. It should, by all accounts, have been quick. It wasn't, there were a ton of booby traps, and unless you have innate knowedge of the inner workings of the android build tools, it's a little bit of a mysterious beast. Here's what I did: