I have been trying to change, decompile, and recompile Trebuchet to change the items on the dock and home screen. I keep getting errors, and I think I have finally found the solution.
The output of the command is quite long, so let me post the beginning:
skp@chestnut:~/app/hd2/dev/work$ apktool b Trebuchet-orig Trebuchet.apk I: Copying classes.dex file... I: Checking whether resources has changed... I: Building resources... invalid resource directory name: /home/skp/app/hd2/dev/work/Trebuchet-orig/res/values-sw720dp-land invalid resource directory name: /home/skp/app/hd2/dev/work/Trebuchet-orig/res/drawable-sw600dp-nodpi invalid resource directory name: /home/skp/app/hd2/dev/work/Trebuchet-orig/res/drawable-sw600dp-land-hdpi
And, here’s the end of the output:
invalid resource directory name: /home/skp/app/hd2/dev/work/Trebuchet-orig/res/layout-sw720dp Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL1399953021396634018.tmp, -I, /home/skp/apktool/framework/1.apk, -S, /home/skp/app/hd2/dev/work/Trebuchet-orig/res, -M, /home/skp/app/hd2/dev/work/Trebuchet-orig/AndroidManifest.xml] at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193) at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301) at brut.androlib.Androlib.buildResources(Androlib.java:248) at brut.androlib.Androlib.build(Androlib.java:171) at brut.androlib.Androlib.build(Androlib.java:154) at brut.apktool.Main.cmdBuild(Main.java:182) at brut.apktool.Main.main(Main.java:67) Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL1399953021396634018.tmp, -I, /home/skp/apktool/framework/1.apk, -S, /home/skp/app/hd2/dev/work/Trebuchet-orig/res, -M, /home/skp/app/hd2/dev/work/Trebuchet-orig/AndroidManifest.xml] at brut.util.OS.exec(OS.java:83) at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191) ... 6 more
What I finally found, was that I installed an old or invalid version of aapt with apktool. It was installed into /usr/local/bin…
skp@chestnut:~/app/hd2/dev/work$ which aapt /usr/local/bin/aapt skp@chestnut:~/app/hd2/dev/work$ ll `which aapt` -rwxr-x--- 1 skp skp 3747857 May 15 2011 /usr/local/bin/aapt*
The easy fix was to just rename this one installed with apktool. Then, it pulled the one from my Android SDK intallation. (I already had the platform-tools directory in the path.)
skp@chestnut:~/app/hd2/dev/work$ cd /usr/local/bin/ skp@chestnut:/usr/local/bin$ sudo mv aapt aapt-broken [sudo] password for skp: skp@chestnut:/usr/local/bin$ which aapt /home/skp/app/android-sdk-linux/platform-tools/aapt
After that, it compiled fine!
skp@chestnut:~/app/hd2/dev/work$ apktool b Trebuchet-orig Trebuchet.apk I: Checking whether resources has changed... I: Building resources... I: Building apk file...