Files
voidandClaude Sonnet 4.6 c29e425996 chore(agents): 添加 Android 逆向工程 skill
包含 APK 反编译、API 调用提取、调用链分析、Kotlin 名称恢复等参考文档,
以及 jadx/fernflower 相关脚本与第三方域名过滤列表。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-11-08 21:15:24 +08:00

4.7 KiB

Setup Guide: Dependencies for Android Reverse Engineering

Java JDK 17+

jadx requires Java 17 or later.

Ubuntu / Debian

sudo apt update
sudo apt install openjdk-17-jdk

Fedora

sudo dnf install java-17-openjdk-devel

Arch Linux

sudo pacman -S jdk17-openjdk

macOS (Homebrew)

brew install openjdk@17

After installation on macOS, follow the symlink instructions printed by Homebrew, or add to your shell profile:

export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"

Verify

java -version
# Should show version 17.x or higher

jadx

jadx is the Java decompiler used to convert APK/JAR/AAR files to readable Java source.

  1. Go to https://github.com/skylot/jadx/releases/latest
  2. Download the jadx-<version>.zip file (not the source archive)
  3. Extract and add to PATH:
unzip jadx-*.zip -d ~/jadx
export PATH="$HOME/jadx/bin:$PATH"
# Add the export line to your ~/.bashrc or ~/.zshrc for persistence

Option 2: Homebrew (macOS / Linux)

brew install jadx

Option 3: Build from source

git clone https://github.com/skylot/jadx.git
cd jadx
./gradlew dist
# Binaries will be in build/jadx/bin/
export PATH="$(pwd)/build/jadx/bin:$PATH"

Verify

jadx --version

Fernflower is the JetBrains Java decompiler. It produces better output than jadx on complex Java constructs, lambdas, and generics. Vineflower is the actively maintained community fork with published releases — prefer it over upstream Fernflower.

  1. Go to https://github.com/Vineflower/vineflower/releases/latest
  2. Download vineflower-<version>.jar
  3. Place it and set the environment variable:
mkdir -p ~/vineflower
mv vineflower-*.jar ~/vineflower/vineflower.jar
export FERNFLOWER_JAR_PATH="$HOME/vineflower/vineflower.jar"
# Add the export to ~/.bashrc or ~/.zshrc for persistence

Option 2: Build Fernflower from source

git clone https://github.com/JetBrains/fernflower.git
cd fernflower
./gradlew jar
# Produces: build/libs/fernflower.jar
export FERNFLOWER_JAR_PATH="$(pwd)/build/libs/fernflower.jar"

Option 3: Homebrew (Vineflower)

brew install vineflower

Verify

java -jar "$FERNFLOWER_JAR_PATH" --version

Note

: Fernflower only works on JVM bytecode (JAR, class files). For APK/DEX files, you also need dex2jar (see below) as an intermediate conversion step.


dex2jar (optional, needed for Fernflower on APK files)

Converts Android DEX bytecode to standard Java JAR files.

GitHub Releases

  1. Go to https://github.com/ThexXTURBOXx/dex2jar/releases/latest
  2. Download and extract:
unzip dex-tools-*.zip -d ~/dex2jar
export PATH="$HOME/dex2jar:$PATH"

Homebrew

brew install dex2jar

Verify

d2j-dex2jar --help

Usage

# Convert APK (or DEX) to JAR
d2j-dex2jar -f -o output.jar app.apk

# Then decompile with Fernflower
java -jar vineflower.jar output.jar decompiled/

Optional Tools

apktool

Useful for decoding resources (XML layouts, drawables) that jadx sometimes handles poorly.

# Ubuntu/Debian
sudo apt install apktool

# macOS
brew install apktool

# Manual: https://apktool.org/docs/install

adb (Android Debug Bridge)

Useful for pulling APKs directly from a connected Android device.

# Ubuntu/Debian
sudo apt install adb

# macOS
brew install android-platform-tools

Pull an APK from a device:

# List installed packages
adb shell pm list packages | grep <keyword>

# Get APK path
adb shell pm path com.example.app

# Pull the APK
adb pull /data/app/com.example.app-xxxx/base.apk ./app.apk

Troubleshooting

Problem Solution
jadx: command not found Ensure the jadx bin/ directory is in your $PATH
Error: Could not find or load main class Java is missing or wrong version — verify with java -version
jadx runs out of memory on large APKs Increase heap: jadx -Xmx4g -d output app.apk or set JAVA_OPTS="-Xmx4g"
Decompiled code has many // Error comments Try --show-bad-code to see partial output, or use --deobf for obfuscated apps
Fernflower hangs on a method Use -mpm=60 to set a 60-second timeout per method
Fernflower JAR not found Set FERNFLOWER_JAR_PATH env variable to the full path of the JAR
dex2jar fails with ZipException The APK may have a non-standard ZIP structure — try jadx instead