apktool-android is an Android library (AAR) that runs Apktool’s decode → edit project tree → rebuild flow inside your app process. You get a normal resource/smali workspace on disk and a rebuilt APK without relying on a desktop CLI, Termux, adb shell, or root. The AAR ships per-ABI libaapt2.so (fully static, NDK-built) and a small entry point—ApktoolAndroid.configure(Context)—that points Apktool at executable-safe paths on Android (nativeLibraryDir, app filesDir / cacheDir).
| In scope | Out of scope |
|---|---|
In-app decode/build using ApkDecoder / ApkBuilder with Android-safe Config |
Installing or documenting the desktop apktool JAR/CLI workflow |
Bundled aapt2 as libaapt2.so + optional self-build docs under aapt2-build/ |
Fork maintenance of upstream Apktool feature roadmaps |
| Doc | Purpose |
|---|---|
| USAGE.md | Android integration: Gradle, manifest, ApktoolAndroid, full Config reference, threading, heap, releases |
| aapt2-build/README.md | Rebuild and install libaapt2.so for jniLibs/; output contract; licence notes |
| aapt2-build/SELF_BUILD_PLAN.md | Self-build strategy, patch stack, and historical runbook |
| aapt2-build/patches/README.md | Canonical vs recipe-local patches; re-export procedures |
./gradlew :brut.apktool:apktool-android:assembleRelease
# Output: brut.apktool/apktool-android/build/outputs/aar/apktool-android-release.aarNote: If you drop only that AAR into another app, you must also vendor the runtime JARs from
./gradlew :brut.apktool:apktool-android:collectRuntimeJars— see USAGE.md — Gradle integration.
For JVM/unit tests on apktool-lib and instrumented tests, see Building from source in USAGE.md.
- iBotPeaches/Apktool — The resource table, smali/DEX, and rebuild pipeline live in
apktool-liband come from the main Apktool project. apktool-android only adds the Android packaging, paths, andaapt2binary story. - ReVanced/aapt2 — The cross-compile recipe (CMake, AOSP submodule pin, patch flow) is vendored under
aapt2-build/recipe/and extended as documented inaapt2-build/README.md. - Critical
aapt2patches (authors) — We keep canonical diffs underaapt2-build/patches/for audit and attribution:- 0001 — Apktool port changes for custom
aapt2usage — Connor Tumbleson. Documents the baseline leniency/linking work for Apktool-drivenaapt2; the recipe build applies ReVanced’sapktool_ibotpeaches.patch, which is a superset of this file (see patches/README.md). - 0002 — Unrestrict value format for
<item>tags — Igor Eisberg (patch author; merged on the Apktool side as PR #3130). Letsaapt2accept modern<item type="layout" format="…">patterns so Play-Store–style APKs rebuild withoutinvalid value for type 'layout'. Expected a reference.A re-rooted copy is applied on top of ReVanced’s stack in the live build (patch stack).
- 0001 — Apktool port changes for custom
Apache-2.0 — see LICENSE.md. The vendored ReVanced build scripts under aapt2-build/recipe/ are GPL-3.0 (their LICENSE is preserved). The shipped libaapt2.so binaries and the AAR are not GPL-3.0; see Licence story in aapt2-build/README.md.