Development Blog - Apktool

This marks the 10th hour I've been stuck on the same apktool problem, at one computer sitting. Its now 11pm and I've been at this for a long time. The problem is simply some HTC Sense 4.0 APKs don't like to be decompiled & recompiled. At first I thought there was a resource qualifier update. I've looked at all the DIFF reports from Android: (API 16) http://developer.android.com/sdk/apidiff/16/changes.html which shows the addition of int UIMODETYPEAPPLIANCE. Which, apktool as of v1.4.8 has had support for.

No matter what. I get

W: Config flags size > 36. Exceeding bytes: 0x2000000.
W: Invalid config flags detected: dimen-hdpi-ERR0
W: Config flags size > 36. Exceeding bytes: 0x4000000.
W: Invalid config flags detected: dimen-hdpi-ERR1
W: Config flags size > 36. Exceeding bytes: 0x5000000.

a large collection of these. Which is simple. The config size has changed. Its now at 40 instead of 36. Which means we're missing 4 bytes of data which I know is a qualifier that I'm missing. I use "aapt b configuration com.htc.resources.apk" to try and figure it out (Since either HTC or Android is not documenting something well).

imsi=0/0 lang=-- reg=-- orient=2 touch=0 dens=0 kbd=0 nav=0 input=0 ssz=0x0 sw0dp w0dp h0dp sz=0 long=0 ui=0 night=0 vers=0.0
imsi=0/0 lang=-- reg=-- orient=1 touch=0 dens=240 kbd=0 nav=0 input=0 ssz=0x0 sw0dp w0dp h0dp sz=0 long=0 ui=0 night=0 vers=4.0
imsi=0/0 lang=-- reg=-- orient=1 touch=0 dens=320 kbd=0 nav=0 input=0 ssz=0x0 sw0dp w0dp h0dp sz=0 long=0 ui=0 night=0 vers=4.0

This prints out the above list with around 40 of these instead of 3. I set my breakpoints in Netbeans and watched these qualifers one by one be reproduced by apktool. Then it fails. I noticed a density that was 33665 which looked a little akward. I thought maybe that it overflowed into the next container (keyboard) and messed up the reading. However, I was wrong.

I've tried everything trying to figure out these APKs. After a night sleep. I'm just going to print out the entire byte array of each APK and compare it one by one to the documentation. I'm missing something and I'm bound to find it eventually.

Top