apktool
Decode and encode Android APK files
TLDR
Decode an APK file
Build an APK file from a directory
Install and store a framework
SYNOPSIS
apktool d[ecode] [options]
PARAMETERS
d, decode
Decode the APK file.
b, build
Build an APK from a decoded directory.
f, --force
Force delete destination directory (when decoding) or rebuild even if resources were not changed (when building).
-o, --output
Specify the output file name.
-s, --no-src
Do not decode sources.
-r, --no-res
Do not decode resources.
--keep-broken-res
Use resources even if they are broken (when building).
--frame-path
Specify framework directory.
--use-aapt2
Use AAPT2 for building (if available).
DESCRIPTION
apktool is a powerful command-line tool for reverse engineering and rebuilding Android APK files. It allows you to decode resources to nearly original form and rebuild them after making some modifications. apktool facilitates the analysis and customization of Android applications by decoding the AndroidManifest.xml, resources, and smali code. You can use it to translate string resources, modify layouts, and even debug applications. The tool is primarily used by developers, security researchers, and Android enthusiasts to understand how an application is structured and how it functions.
Once changes are made, apktool can rebuild the decoded resources back into an APK. This rebuilt APK can be signed and installed, though signing is not handled by apktool itself. It is crucial to note that redistributing modified APKs without proper authorization can be a violation of copyright and licensing agreements.
CAVEATS
The rebuilt APK needs to be signed separately using tools like jarsigner or similar signing utilities before installation on an Android device or distribution.
FRAMEWORK FILES
apktool often requires framework files to be installed for correct decoding and building. This is usually necessary when working with system applications or APKs that rely on platform-specific resources. Use apktool if
SMALI
The decompiled code is presented in smali, an assembly language for the Dalvik Virtual Machine (DVM). Understanding smali is important for modifying the application's logic.
HISTORY
apktool has been in development for many years and has become a standard tool for Android reverse engineering. It evolved from earlier attempts to decompile and recompile Android resources and has seen substantial improvements in accuracy and features. It is still actively maintained and supports newer versions of the Android SDK.