How to build the latest version of apktool?

apktool is an Android apk decompilation program. It is command line based, and requires java to run. It can be run on both Windows and Linux systems.

Officially, apktool was last updated in February 2013. But development on apktool is highly active, and it makes sense to get the latest version with all bug fixes and cutting edge features. If you need the latest development version of apktool, you need to compile apktool from source.

I tried this on a Debian 7 x64 based VPS on an OpenVZ virtualization.

First download and extract the Android SDK (you need aapt from the SDK):
Visit http://developer.android.com/sdk/index.html
Click on “DOWNLOAD FOR OTHER PLATFORMS”
Download the version for Linux 64-bit: Eg: http://dl.google.com/android/adt/22.6.2/adt-bundle-linux-x86_64-20140321.zip

wget http://dl.google.com/android/adt/22.6.2/adt-bundle-linux-x86_64-20140321.zip
unzip adt-bundle-linux-x86_64-20140321.zip
cd adt-bundle-linux-x86_64-20140321/

Find the location of aapt and add its path to the PATH variable:

find . -iname 'aapt'
export PATH=$PATH:/home/adt-bundle-linux-x86_64-20140321/sdk/build-tools/android-4.4.2

Get the latest development version source:

git clone https://code.google.com/p/android-apktool/
cd android-apktool/
./gradlew build fatJar

If all went well, you’ll get a “build successful” message.
The new jar will be saved as ./brut.apktool/apktool-cli/build/libs/apktool-cli.jar


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.