# How to Use decode.ps1 for Unified APK Decompilation

> Master unified APK decompilation with decode.ps1. This script uses jadx, apktool, and aapt to extract Java source, XML, and manifest data from APKs with a single command. Learn how now.

- Repository: [ZhaoXu/reverse-skill](https://github.com/zhaoxuya520/reverse-skill)
- Tags: how-to-guide
- Published: 2026-08-02

---

**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.dex` files 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 (`.so` files)
- 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`](https://github.com/zhaoxuya520/reverse-skill/blob/main/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 files
- `apktool_output/` — Resolved resources, manifests, and native libraries
- [`summary.txt`](https://github.com/zhaoxuya520/reverse-skill/blob/main/summary.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:

```powershell
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):

```powershell
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.ps1`** serves as the unified control script for APK decompilation in zhaoxuya520/reverse-skill, coordinating jadx, apktool, and manifest analysis tools
- **Automatic bootstrapping** via `bootstrap-reverse.ps1` installs 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`](https://github.com/zhaoxuya520/reverse-skill/blob/main/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.