How to Use decode.ps1 for Unified APK Decompilation
The decode.ps1 script in the zhaoxuya520/reverse-skill repository orchestrates jadx, apktool, and aapt to extract readable Java source, XML resources, and manifest data from Android APKs using a single parameterized PowerShell command.
The decode.ps1 PowerShell script serves as the central automation engine for Android reverse engineering within the zhaoxuya520/reverse-skill repository. Located at skills/apk-reverse/scripts/decode.ps1, this unified decompilation tool eliminates manual coordination between multiple utilities by chaining DEX decompilation, resource extraction, and manifest analysis into one streamlined workflow. Understanding how to use decode.ps1 for unified APK decompilation allows security researchers and developers to obtain complete APK structures without managing complex tool dependencies individually.
What decode.ps1 Automates
According to the zhaoxuya520/reverse-skill source code, decode.ps1 functions as a unified orchestration layer that coordinates three distinct reverse engineering operations:
- jadx: Converts
classes.dexfiles into readable Java-like source code - apktool: Unpacks binary XML resources, assets, and native libraries while rebuilding the project layout
- aapt: Extracts manifest metadata for structural analysis
The script automatically sequences these tools to produce a complete decompilation environment, followed by execution of manifest-summary.ps1 to generate a human-readable summary of the application's structure.
Automatic Dependency Management
Before executing the decompilation pipeline, decode.ps1 verifies the presence of required dependencies on the host system. If either jadx or apktool is missing, the script automatically invokes bootstrap-reverse.ps1 from the repository root to install the necessary tools and Java runtime【/skills/apk-reverse/SKILL.md Line 393】. This bootstrap mechanism ensures first-time users can run the script immediately without manual environment configuration.
Parameter-Driven Execution
The script accepts several PowerShell parameters that control the decompilation scope and output behavior:
-ApkPath(required): Absolute or relative path to the target APK file-Name(optional): Custom prefix for the output directory (defaults to APK filename)-Clean: Removes existing output directories before execution to ensure fresh results-SkipJadx: Bypasses the Java source decompilation stage, useful for resource-only analysis
These parameters enable both full decompilation workflows and targeted extractions depending on analytical requirements.
The Three-Stage Decompilation Pipeline
When executed, decode.ps1 processes the APK through three distinct phases:
Stage 1: DEX Decompilation with jadx
Unless the -SkipJadx flag is present, the script first runs jadx to convert Android DEX bytecode into readable Java source files. These outputs are organized within the jadx_output/ subdirectory, preserving package structures and class hierarchies for code review.
Stage 2: Resource Extraction with apktool
Next, apktool unpacks the APK's binary components, including:
- Decoded XML layouts and manifests
- Asset files and raw resources
- Native libraries (
.sofiles) - Smali bytecode (if needed for debugging)
This stage populates the apktool_output/ directory with a reconstructible Android project structure.
Stage 3: Manifest Summarization
Finally, the script executes manifest-summary.ps1 to parse the extracted manifest and generate summary.txt. This report provides concise metadata regarding permissions, component declarations, and package information without requiring manual XML parsing.
Output Directory Structure
All generated artifacts are organized under a timestamped folder named <Name>_decode_<timestamp> (or the default APK-derived name if -Name is omitted). The standard layout includes:
jadx_output/— Decompiled Java source code from DEX filesapktool_output/— Resolved resources, manifests, and native librariessummary.txt— Human-readable manifest report generated by the summarization script
This structured output eliminates manual file organization and provides immediate access to both code and resource layers.
Practical Usage Examples
Execute full decompilation with cleanup of previous results:
pwsh -File "<skill-root>\apk-reverse\scripts\decode.ps1" -ApkPath "D:\DOWNLOAD\app.apk" -Clean
Perform resource-only analysis with custom naming (skipping Java decompilation):
pwsh -File "<skill-root>\apk-reverse\scripts\decode.ps1" -ApkPath "D:\DOWNLOAD\app.apk" -Name demo -SkipJadx
Both examples are taken directly from the skill documentation【/skills/apk-reverse/SKILL.md Line 69‑70】.
Summary
decode.ps1serves as the unified control script for APK decompilation in zhaoxuya520/reverse-skill, coordinating jadx, apktool, and manifest analysis tools- Automatic bootstrapping via
bootstrap-reverse.ps1installs missing dependencies when required - Flexible parameters (
-Clean,-SkipJadx,-Name) allow customization of the decompilation scope and output management - Structured output organizes Java sources, resources, and manifest summaries into timestamped directories for immediate analysis
Frequently Asked Questions
What tools does decode.ps1 require to run?
The script requires jadx for DEX decompilation, apktool for resource extraction, and aapt for manifest analysis. If these are missing, decode.ps1 automatically triggers bootstrap-reverse.ps1 to install them before proceeding with the unified APK decompilation.
How do I decompile only resources without extracting Java source code?
Pass the -SkipJadx parameter when invoking the script. This executes only the apktool and manifest summarization stages, significantly reducing processing time when you need only XML layouts, assets, and manifest metadata.
Where are the decompiled files saved?
By default, outputs are placed in a directory named <Name>_decode_<timestamp> within the execution context. Inside, you will find jadx_output/ for source code, apktool_output/ for resources, and summary.txt for the manifest report. Use the -Name parameter to customize the directory prefix.
Can I run decode.ps1 on Linux or macOS?
While decode.ps1 is a PowerShell script, it can execute on Linux and macOS using PowerShell Core (pwsh). However, ensure that the underlying tools (jadx, apktool) are compatible with your platform, as the bootstrap script may require platform-specific adjustments for non-Windows environments.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →