Android App Hardening · APK Shielding

Wrap your Android app
in a shell.

Your original DEX is encrypted and hidden in assets, then restored at runtime by a StubApp and a native engine. Reverse engineers get a shell, not your code. One command runs decompile, encrypt, inject, align, and re-sign.

✓ Verified end-to-end ✓ v1 / v2 / v3 signing ✓ 4-ABI native engine
Capabilities

What it does

Six protections working together: your code is encrypted, the entry point is replaced, the runtime is guarded.

DEX

DEX encryption

The original classes.dex is packed, encrypted, and hidden in assets — no plaintext code remains in the APK. Custom stream cipher, a fresh random key per build.

stream cipherrandom dexKey
SO

Native engine

libjiaguo.so is the runtime engine across four ABIs. Decryption, integrity checks, and swapping back the real Application all happen in native code.

arm64-v8aarmeabi-v7ax86_64mips64
RUN

Shell loader

StubApp loads the .so in attachBaseContext, reads cls_key to derive the dexKey, restores the original DEX, and swaps the real entry back via RefInvoke.

StubAppRefInvoke
DBG

Anti-debugging

Detects ptrace via TracerPid in /proc/self/status, and a watchdog thread catches timing drift — it exits on anomaly.

ptracewatchdog
ENV

Environment detection

Flags root, Xposed / Substrate, HTTP proxy, VPN, app-cloning, USB debugging, and developer options.

rootXposedVPN/proxycloning
SIG

Multi-scheme signing

Re-signs with apksig: JAR (v1) plus APK Signature Scheme v2 / v3, covering old and new Android.

v1v2v3
Pipeline

Eight steps per run

From a raw APK to a hardened build — every step verified on a real APK.

01

Decompile

apktool unpacks the APK; extract DEX, resources, manifest.

02 · core

Encrypt DEX

Original DEX encrypted with a random key, written to assets.

03

Build cls_key

dexKey / signa / init_pass metadata, encrypted as a whole.

04 · core

Inject shell

StubApp shell DEX and libjiaguo.so placed into the package.

05

Rewrite Manifest

application entry replaced with the shell's StubApp.

06

Repack

apktool rebuilds to an unsigned APK.

07

Align

zipalign does 4-byte alignment.

08

Re-sign

apksig signs v1 / v2 / v3.

Spec

Technical spec

No black box. Encryption, keys, signing, and platforms are all here.

Encryption & keys

Ciphercustom stream · ^key ^3 -5
Digest / encodingMD5 · Base64
DEX keyrandom per build
Large-file speedupfirst 2048 bytes partial
Config validityconfig.dll created + 540 days

Packaging & platform

Shell entrycom.youyou.shell.StubApp
Native enginelibjiaguo.so × 4 ABI
Signingapksig v1 / v2 / v3
UIJava Swing · FlatLaf
PlatformWindows · Linux
Verified

It actually works

We unshell a hardened APK with the tool's own algorithm — deriving the dexKey from cls_key, restoring the embedded encrypted DEX, and comparing it byte-for-byte with the original.

unshell — verify
$ unshell app_shell_sign.apk [*] decrypt cls_key (base key 2025-03-33) ok [*] parse 4 sections → pkg · init · setting ok [*] derive dex key z1794410448637z1794410448643_3.3.7 [*] decrypt assets/nivye → PK␃␄ valid ZIP ok [*] extract classes.dex ok
original dex 776 B  md5 7943a0e0964c227d5351bd4a7eccfd1b
recovered 776 B  md5 7943a0e0964c227d5351bd4a7eccfd1b
★Byte-for-byte identicalreversible · the shell restores the original app

This is exactly what the shell (StubApp + libjiaguo.so) does at runtime on a real device — proving the chain is complete, the key system correct, and the original app recoverable.

Quick Start

Quick start

A Gradle project on JDK 21. Launch the GUI to pick an APK and keystore and hit start, or drive it from the command line.

↓ Prefer a prebuilt binary? Grab zhidun.exe or the cross-platform jar from the latest release — needs Java 21.

Launch the GUI
$ ./gradlew run # or build a single runnable jar $ ./gradlew fatJar $ java -jar build/libs/zhidun-3.3.7-all.jar
Runtime layout
workdir/ ├─ config.dll # shell resource pack └─ tools/ ├─ apktool(.bat) # Win / Linux └─ zipalign(.exe) # sign with your own keystore

※ The tool looks for config.dll and tools/ in the working directory or next to the chosen APK. On Windows use apktool.bat + zipalign.exe; on Linux the extension-less versions.