Apktool is a command-line tool for reverse engineering Android APK files. It decodes binary resources (resources.arsc, AndroidManifest.xml, 9-patch images) back to nearly original form, disassembles DEX bytecode into Smali assembly using baksmali, and provides a rebuild pipeline that reassembles and signs the APK via aapt2 and apksigner. The tool manages Android framework APK installations to resolve resource references during decoding. The architecture is a multi-module Gradle project: a core library (apktool-lib) exposing programmatic APIs (ApkDecoder, ApkBuilder, ResTable, Framework), and a CLI wrapper (apktool-cli) that provides commands like decode, build, install-framework, and list-frameworks. Supporting libraries (brut.j.util, brut.j.dir, brut.j.yaml, brut.j.xml) handle I/O, directory abstraction, YAML metadata, and XML serialization. External dependencies include Google's aapt2 binary (bundled per platform) and the smali/baksmali libraries for DEX compilation. The codebase demonstrates deep knowledge of Android binary formats, with custom parsers for chunked resource tables, binary XML, and resource qualifiers, and includes extensive regression tests covering edge cases and security vulnerabilities.