LinuxCommandLibrary

apktool

Decode and encode Android APK files

TLDR

Decode an APK file

$ apktool d [path/to/file].apk
copy

Build an APK file from a directory
$ apktool b [path/to/directory]
copy

Install and store a framework
$ apktool if [path/to/framework].apk
copy

SYNOPSIS

apktool [options] {d|decode|b|build|if|install-framework} [opts] args

PARAMETERS

-v, --verbose
    Verbose output for debugging

-q, --quiet
    Suppress all output

-f, --force
    Force overwrite of existing output

-o

, --output
    Specify output directory or APK name

--use-aapt1
    Force use of legacy AAPT1

--use-aapt2
    Force use of AAPT2 (default)

--aapt
    Custom path to AAPT binary

--aapt2
    Custom path to AAPT2 binary

--framework
    Use specific framework directory

--use-framework
    Directories holding frameworks

--tag
    Tag decode/build process

--debug
    Enable apktool debug mode

d, decode []
    Decode APK to smali/resources

b, build []
    Build directory into APK

if, install-framework
    Install APK framework

DESCRIPTION

Apktool is a Java-based, open-source utility for reverse engineering Android APK files. It decodes APKs into their nearly original form, extracting resources like XML layouts, images, strings, and converting Dalvik bytecode to editable Smali code. This enables inspection, modification, and rebuilding for tasks such as app analysis, customization, security research, or modding.

Primary operations include decoding (disassembling APK to a project directory) and building (recompiling modified resources into a new APK). It supports framework installation for system apps, handles multiple APKs, and integrates with AAPT/AAPT2 for resource processing.

Cross-platform and lightweight, apktool requires Java 8+ and is popular among developers and pentesters. Note that rebuilt APKs are unsigned and must be signed (e.g., with apksigner) before installation. Limitations include struggles with heavily obfuscated code or proprietary protections. Usage is straightforward via command-line, with verbose output for debugging.

CAVEATS

Requires Java 8+. Rebuilt APKs are unsigned and unaligned; sign with apksigner or jarsigner. Fails on obfuscated/protected apps. Not a native Linux binary; use wrapper script.

INSTALLATION

Download JAR from https://ibotpeaches.github.io/Apktool/. Run java -jar apktool.jar or use provided bash wrapper: chmod +x apktool.

EXAMPLES

apktool d app.apk -o outdir
apktool b outdir -o new.apk
apktool if framework-res.apk

HISTORY

Originally created in 2010 by Ryszard Wiśniewski (brut.all). Maintained by Connor Tumbleson (iBotPeaches) since 2013, with ongoing updates for new Android versions up to 14+. Evolved from simple decompiler to full build suite.

SEE ALSO

java(1), unzip(1), zip(1)

Copied to clipboard