title: Repackage APK file to contain custom assets - what build tool to use?
body: <p><strong>Update</strong>: This is an old post, and references below to broken <code>aapt</code> versions will be out of date.</p>
  
  <hr>
  
  <p>Based on previous feedback, I am storing custom text fields in the assets directory of my app.</p>
  
  <p>I will write the app, using default user details in an asset file, and the client would like to rebuild the app for each user, including that user's details in the asset file.</p>
  
  <p>(I am aware this is method has some serious shortcomings, but the client is still keen to do it in this way - see <a href="https://stackoverflow.com/questions/4783160/embed-login-details-in-apk-file-different-for-each-user-or-other-options">Embed login details in APK file, different for each user (or other options?)</a>)</p>
  
  <p>This question relates to troubles I am having with rebuilding the APK file, once I have unzipped it, and updated the custom asset file. I am quite convinced I am missing something small, however, the documentation and posts I have found on these methods are not helpful enough for a newcomer.</p>
  
  <ol>
  <li><p>aapt - Android sdk tool: Unfortunately the android docs on "Using aapt" on the android docs [link 2 below] are very limited. The console command -help shows a bit more info. When trying to use it to just add a file to the test.apk, it ends up deleting the original, and creating a new file test.apk.zip containing only the file I tried to add. I have not been able to find the correct command line combination to take an unzipped apk and repackage it - that would be my first prize.</p></li>
  <li><p>apkbuilder - Android sdk tool: Firstly this tool is deprecated, which is a negative point for it. I also can't get it to work with what I have in that unzipped folder. I think I'm missing a pre-apkbuilder step because apkbuilder asks for a resource zip archive, and I have a resource folder.</p></li>
  <li><p>ant - build tool: Other similar posts say to build with ant, rather than using the android tools. I am having trouble getting ant to work. One particular link to Getting Ant to Work with Android [link 3 below] looks promising but looks like it is for a different android sdk (my build.xml that is generated by android looks different to his). Unfortunately I know little about ant, and am having trouble becoming expert enough to solve my current issue.<br>
  Further to NickT's solution below - running the ant script gives me the error<br>
  <em>taskdef class com.android.ant.SetupTask cannot be found using the classloader AntClassLoader[]</em>.<br>
  I have found some references online to this error, have confirmed that local.properties has an sdk.dir setting that is pointing to my android sdk install folder (sdk.dir=/Applications/android-sdk-mac_86).</p></li>
  <li><p>?????: There might be some other option that I have not listed / discovered, which I would be interested in hearing about. </p></li>
  </ol>
  
  <p>I realize that delving into the gears that are normally covered up by my ide can lead to diffuculties. But I know that a lot of the SO users can do many of these things, and I hope I get the interest of some of them. Thanks for any help.</p>
  
  <p>(Eclipse 3.6 on Mac Snow Leopard 10.6 64 bit)</p>
  
  <p>PS, I am not able to post more than 1 hyperlink yet, so I have included these addresses to show more info to my question.</p>
  
  <p>(1): stackoverflow.com/questions/4783160/embed-login-details-in-apk-file-different-for-each-user-or-other-options</p>
  
  <p>(2): developer.android.com/guide/developing/tools/aapt.html</p>
  
  <p>(3): www.disgruntledrats.com/?p=27</p>