title: Multiple Android Application Package .apk files from single source code
body: <p>I would like an Android build system procedure, command line or Eclipse, to generate several .apk files from a single source codebase. Some common reasons for this - having specific versions for markets with different requirements or a free and paid version.</p>
  
  <p>This question IS <em>NOT</em> ABOUT:</p>
  
  <ul>
  <li><p>Packaging shared code into <a href="http://developer.android.com/guide/developing/projects/projects-eclipse.html#SettingUpLibraryProject" rel="noreferrer">Android libraries</a> or into external Java jars</p></li>
  <li><p>Producing a debug vs. <a href="http://developer.android.com/guide/publishing/app-signing.html" rel="noreferrer">signed release .apk</a></p></li>
  </ul>
  
  <p>Google <a href="http://developer.android.com/guide/market/publishing/multiple-apks.html#CreatingApks" rel="noreferrer">says</a> "you probably need to create separate Android projects for each APK you intend to publish so that you can appropriately develop them separately. You can do this by simply duplicating your existing project and give it a new name." Then they kindly suggest using libraries, which I understand. Then, they mention in passing exactly what I do want: "a build system that can output different resources based on the build configuration"</p>
  
  <ul>
  <li><p>I know that to accomplish conditional compilation in <em>JAVA</em> one can key off a 'public static final' variable. There is an <a href="http://groups.google.com/group/android-developers/browse_thread/thread/f2c8b35edf131f76" rel="noreferrer">example of tweaking</a> such a value in build.xml. Any more complete example of an Android Ant build configuration for this or a link to an OSS project doing that now, please? BTW, build.xml is auto-generated, but I have seen people hacking it, so how does that work?</p></li>
  <li><p>With the package name declared in Manifest.xml as package="com.example.appname", if one needs to emit multiple .apks that vary that name, is one stuck with a separate project for each?</p></li>
  </ul>