Wednesday, 8 June 2011

Decompiling Android package resources

Sometimes you see a screen in an Android app and you think to yourself: "I wonder how that layout was achieved..."

An initial thought, especially once you realise that .apk files are just ZIP archives, is to just pull the layout xml file out and take a peek. Alas this thought gets you not very far at all as the .apk has the constituent files encoded or tokenised or somehow made unreadable and unusable.

It turns out that apktool is the answer here as it can unpack the resources and decode them into original format so you can browse the layout (as well as the other packed resouces).

Don't forget to read the "Installation for noobs" section - I missed that to start witha and so got stuck for a while. However I'd put the two downloads into a a dedicated directory on the path, rather than the Windows directory, but that's a personal choice.