android - Repackage APK file to contain custom assets - what build tool to use? -


update: old post, , references below broken aapt versions out of date.


based on previous feedback, storing custom text fields in assets directory of app.

i write app, using default user details in asset file, , client rebuild app each user, including user's details in asset file.

(i aware method has serious shortcomings, client still keen in way - see embed login details in apk file, different each user (or other options?))

this question relates troubles having rebuilding apk file, once have unzipped it, , updated custom asset file. quite convinced missing small, however, documentation , posts have found on these methods not helpful enough newcomer.

  1. aapt - android sdk tool: unfortunately android docs on "using aapt" on android docs [link 2 below] limited. console command -help shows bit more info. when trying use add file test.apk, ends deleting original, , creating new file test.apk.zip containing file tried add. have not been able find correct command line combination take unzipped apk , repackage - first prize.

  2. apkbuilder - android sdk tool: firstly tool deprecated, negative point it. can't work have in unzipped folder. think i'm missing pre-apkbuilder step because apkbuilder asks resource zip archive, , have resource folder.

  3. ant - build tool: other similar posts build ant, rather using android tools. having trouble getting ant work. 1 particular link getting ant work android [link 3 below] looks promising looks different android sdk (my build.xml generated android looks different his). unfortunately know little ant, , having trouble becoming expert enough solve current issue.
    further nickt's solution below - running ant script gives me error
    taskdef class com.android.ant.setuptask cannot found using classloader antclassloader[].
    have found references online error, have confirmed local.properties has sdk.dir setting pointing android sdk install folder (sdk.dir=/applications/android-sdk-mac_86).

  4. ?????: there might other option have not listed / discovered, interested in hearing about.

i realize delving gears covered ide can lead diffuculties. know lot of users can many of these things, , hope interest of of them. help.

(eclipse 3.6 on mac snow leopard 10.6 64 bit)

ps, not able post more 1 hyperlink yet, have included these addresses show more info question.

(1): stackoverflow.com/questions/4783160/embed-login-details-in-apk-file-different-for-each-user-or-other-options

(2): developer.android.com/guide/developing/tools/aapt.html

(3): www.disgruntledrats.com/?p=27

to answer own question method chose, , "for record":

i unable ant working correctly me (my lack of understanding).

i ended using aapt tool. works per android sdk documentation , quite simple use:

aapt add -v test.apk "assets/readme.txt" 

this add readme.txt file (we storing in subfolder of current running folder, called assets. if want store new file somewhere else, aapt offer command line switch specify that)

however, there caveats:

  1. i couldn't work on signed apk files.
  2. some versions of aapt don't work properly! don't recognise subfolder...

to solve 1:

  1. export apk eclipse unsigned apk.
  2. use keytool generate key (see android dev docs).
  3. use aapt.
  4. sign apk using jarsigner.

to solve 2:

i can't this. every version of sdk (on mac) tried download included aapt tool did not recognize subfolders. colleague downloaded version worked, still not figure out version downloaded, kept "magic" copy , renamed , using until find new version works.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -