APK Decompilers
jadx
JD-Gui
Bytecode-Viewer
GDA
CFR
frida-DEXdump
The Smali Workflow
Step 1 — Decompile with apktool
res/values/strings.xml(and all XMLs underres/values/*)AndroidManifest.xml- Any
.sqliteor.dbfiles
apktool d APP.apk -r (skip resource decoding).
Step 2 — Modify Smali Code
Smali is the human-readable representation of Dalvik bytecode. Reference for opcodes: http://pallergabor.uw.hu/androidblog/dalvik_opcodes.htmlHello World Example
Java source:Common Light Modifications
Adding Log Output
Injecting System.loadLibrary() Early
To preload a native library in a static initializer:
Application.onCreate():
Step 3 — Recompile
Step 4 — Sign the APK
Understanding Dalvik / ART
- Android apps are written in Java or Kotlin and compiled to Dalvik Executable (DEX) bytecode
- The Android Runtime (ART) uses Ahead-of-Time (AOT) compilation of DEX to native code
- Smali is the assembly language for DEX — the human-readable form
- baksmali disassembles DEX to Smali; smali assembles Smali back to DEX