Reverse Engineeringandroidapkreverse-engineeringsmalidecompilerebuild

Apktool

Apktool is a tool for reverse engineering Android APK files. It decodes resources to nearly original form, rebuilds them after modifications, and enables debugging of smali code.

Description

Apktool is designed for reverse engineering third-party, closed, binary Android apps. It breaks down APK files into a project-like structure, automating repetitive tasks such as building APKs and making it easier to work with app components.

Use cases include decoding resources and manifests, modifying app behavior, debugging smali code step by step, and rebuilding modified APKs. The tool handles resource tables, AndroidManifest.xml, classes.dex via baksmaling, assets, libs, and unknown files.

It relies on frameworks like android-framework-res and supports both decoding (d) and building (b) operations, with options to skip resources or sources for focused analysis.

How It Works

Apktool loads resource tables from framework files, decodes AndroidManifest.xml with resources, baksmales classes.dex into smali code, copies assets/libs/unknown files, and decodes values XMLs. Decoding produces a editable project structure; building recompiles smali, repackages resources, and outputs a new APK. It uses components like aapt, smali/baksmali, and various Java libraries for parsing and reconstruction.

Installation

bash
sudo apt install apktool

Flags

-dDecode the given APK file
-f, --forceForce delete destination directory (decode)
-o, --output <dir>The name of folder that gets written. Default is apk.out (decode); name of apk that gets written. Default is dist/name.apk (build)
-p, --frame-path <dir>Uses framework files located in <dir> (decode); stores framework files into <dir> (install-framework)
-r, --no-resDo not decode resources
-s, --no-srcDo not decode sources
-t, --frame-tag <tag>Uses framework files tagged by <tag> (decode); tag frameworks using <tag> (install-framework)
--force-allSkip changes detection and build all files (build)
-advance, --advancedPrints advance information
-version, --versionPrints the version then exits

Examples

Use debug mode (d) to decode the given APK file
apktool d Facebook\ Lite_v121.0.0.8.97_apkpure.com.apk
Display help and usage information for apktool
apktool -h
Decode an APK file with various options like -f, -o, -r, -s
apktool d[ecode] [options] <file_apk>
Build a modified app directory back into an APK with options like -f, -o
apktool b[uild] [options] <app_path>
Install a framework APK with options like -p, -t
apktool if|install-framework [options] <framework.apk>
Print the version of apktool and exit
apktool --version
Print advanced information about apktool
apktool --advanced
Updated 2026-04-16kali.org ↗