TL;DR: APKTool decodes an APK into readable smali code and near-original resources, and rebuilds it after your changes. The full loop is
apktool d app.apk -o app_outto decode, edit, thenapktool b app_out -o rebuilt.apkto rebuild, followed by zipalign and signing before install. Use the current 3.0.3 release — most tutorials online still pin old 2.x versions. Only modify apps you own or have permission to test.
APKTool is the standard tool for taking an Android APK apart and putting it back together. It decodes the binary AndroidManifest.xml and resources into readable form, disassembles the DEX code into smali, and rebuilds a working APK from the decoded directory after you change something. It does not produce Java source (that is what JADX does), and the rebuilt APK is unsigned — signing is a separate step covered below.
Common legitimate uses: localizing an app’s strings, removing a permission you do not want an app to have, debugging a build by comparing decoded output across releases, and learning how Android packages are structured. The project’s own site states plainly that it is not intended for piracy — work only with apps you own or have permission to analyze and modify.
Use the current version
A practical warning before the commands: much of the advice online is outdated. Forum guides from the early 2010s still rank in search results, and several recent tutorials pin APKTool 2.9.3, which was already superseded. The current release is 3.0.3 (the last release of the 3.0 line, published on the project’s blog in July 2026), and version 3.0.2 from April 19, 2026 fixed CVE-2026-39973, an arbitrary file write during resource decoding. Staying on 2.x also has a functional cost: releases from 2.9.0 onward made aapt2 the default builder, and older versions cannot even decode APKs built with recent aapt2. There is no reason to install anything older than 3.0.3.
APKTool is a Java program. The only runtime requirement is Java 8 or higher (building APKTool itself from source needs a JDK, but the prebuilt release does not).
Install
| Platform | Steps |
|---|---|
| Linux / macOS | Download the wrapper script for your OS and the apktool_3.0.3.jar from the project’s Bitbucket downloads, rename the jar to apktool.jar, put both on your PATH, and run chmod +x on both. |
| Windows | Download apktool.bat and apktool_3.0.3.jar, rename the jar to apktool.jar, and place both in a directory on your PATH. |
| Verify | Run apktool --version. It should print 3.0.3. |
The release blog publishes md5 and sha256 hashes for the jar. Verify the download against them before running it — the same hash-checking workflow from our APK verification guide applies to any tool in your toolchain. The published sha256 for the 3.0.3 jar is:
dbf930b076c6b9be08d57c449cacefc3bdd6b71ebd59b3066fc0e1f5b14f9423
Step 1: Decode the APK
apktool d app.apk -o app_decoded
d (or decode) unpacks the APK into a project-like directory. If you omit -o, the default output directory is apk.out. Useful options:
| Option | Effect |
|---|---|
-o <dir>, --output |
Output directory (default apk.out) |
-f, --force |
Delete the output directory first if it exists |
-r, --no-res |
Skip resource decoding (much faster when you only need smali) |
-s, --no-src |
Skip smali decoding (faster when you only need resources or the manifest) |
-m, --match-original |
Keep files as close to original as possible; used for inspection when you do not intend to rebuild |
-k, --keep-broken-res |
Continue even if some resources fail to decode, instead of aborting |
--only-manifest |
Decode only the manifest and resources needed for it |
-p <dir>, -t <tag> |
Use a custom framework directory or tagged framework (see troubleshooting) |
A full decode of a large app can take a minute or two. If you only want to inspect the code, add -r; if you only want the resources and manifest, add -s.
Step 2: Understand the decoded directory
| Path | What it is |
|---|---|
smali/ |
Disassembled DEX code in smali format, one directory per package. See our Smali basics guide for reading it. |
res/ |
Decoded resources: layouts, strings, drawables, in near-original XML form. |
AndroidManifest.xml |
The binary manifest decoded to readable XML. |
apktool.yml |
APKTool metadata (package name, version info, framework used). Do not hand-edit unless you know why. |
assets/, lib/ |
Copied as-is: raw assets and native libraries. |
original/ |
A copy of the original manifest and META-INF, kept for reference. |
unknown/ |
Files APKTool did not recognize; copied verbatim and reinserted on rebuild. |
Step 3: Make your changes
Two representative examples:
- Edit a string resource. Open
res/values/strings.xmland change the value of a string, for example the app name or a visible label. This is the simplest possible rebuild test: decode, change one string, rebuild, install, and confirm the change. - Patch smali. Locate the relevant
.smalifile undersmali/and edit an instruction or constant. Smali edits are unforgiving — one wrong register breaks the method — so start from the reading guide linked above before changing anything.
Keep changes small and verifiable: change one thing, rebuild, test, then move on. Renaming packages, swapping large resource sets, or editing apktool.yml are all possible but each multiplies the ways a rebuild can fail.
Step 4: Rebuild the APK
apktool b app_decoded -o rebuilt.apk
b (or build) recompiles the resources with aapt2 and repackages everything. Without -o, the output lands at dist/<name>.apk inside the decoded directory, where <name> comes from the original APK filename.
| Option | Effect |
|---|---|
-o <file>, --output |
Output APK path |
-f, --force |
Skip change detection and rebuild everything |
-a <path> |
Use a specific aapt binary instead of the bundled aapt2 |
--api <level> |
Numeric API level to target when building |
-d, --debug |
Set android:debuggable="true" in the compiled manifest |
-c, --copy-original |
Copy the original manifest and META-INF into the rebuilt APK |
The -d flag is worth knowing for your own apps: it makes the rebuilt APK debuggable, which lets you attach a debugger or use adb shell run-as without editing the manifest by hand.
Step 5: Align and sign (required before install)
zipalign -p -f 4 rebuilt.apk rebuilt-aligned.apk
apksigner sign --ks my-key.keystore --out final.apk rebuilt-aligned.apk
adb install final.apk
zipalign (from the Android SDK build-tools) aligns uncompressed data on 4-byte boundaries; the -p flag aligns native libraries for page alignment. apksigner applies the signature — note that apps targeting Android 11 (API 30) or higher must be signed with the v2 signature scheme or newer on fresh installs, as explained in our guide to the APK signature schemes. A debug keystore generated by Android Studio is fine for testing your own rebuilds.
If adb install reports INSTALL_PARSE_FAILED_NO_CERTIFICATES, the APK was not signed. If it reports a signature mismatch against an installed copy, uninstall the original first — a rebuilt APK carries your signature, not the original developer’s, so the two cannot coexist as updates.
Troubleshooting common failures
| Symptom | Likely cause | Fix |
|---|---|---|
Destination directory ... already exists |
Decoding twice into the same folder | Add -f, or delete the old directory first |
brut.androlib exceptions decoding a system app |
Vendor-specific resources (Samsung, Xiaomi, etc.) need that device’s framework | Pull framework-res.apk from the device and run apktool if framework-res.apk, then decode again |
| aapt2/brut errors with an old APKTool on a recently built app | APKTool older than 2.9.0 cannot handle APKs built by recent aapt2 | Upgrade to 3.0.3 |
| Some resources fail to decode and the build aborts | Obfuscated or malformed resources | Decode with -k to keep going despite broken resources |
| Rebuilt app installs but crashes on launch | Bad smali edit or broken resource reference | Revert to a one-change rebuild and bisect; check logcat for the actual exception |
Key takeaways
- Install 3.0.3, not 2.x. It is the current release (last of the 3.0 line), fixes a real arbitrary-file-write CVE from 3.0.2, and older versions cannot decode APKs built with recent aapt2.
- The loop is decode, edit, build, sign.
apktool d, change one thing,apktool b, thenzipalignandapksigner— the rebuilt APK is unsigned until you sign it. - Use
-ror-sto decode faster when you only need code or only need resources. - Vendor system apps need their framework.
apktool if framework-res.apkfrom the target device fixes most OEM decode failures. - Only touch apps you own or are permitted to test. APKTool’s own documentation draws the line at piracy; this workflow is for research, localization, and debugging.
References
- APKTool official site — project homepage, install documentation, and the statement that the tool is not intended for piracy.
- Apktool 3.0.3 release notes — changelog, download hashes, and the note that 3.0.3 is the last release of the 3.0 line (published July 2026).
- APKTool XDA thread — 3.0.2 changelog including the CVE-2026-39973 arbitrary-file-write fix (April 19, 2026).
Was this useful?
Thanks for the feedback.
3 comments