| name | android-apk-analysis |
| description | Analyze Android APK structure, decompile with JADX, find classes/methods, understand app architecture, and identify targets for patching. Use when reverse-engineering an APK or preparing to write patches. |
| license | MIT |
| compatibility | opencode |
| metadata | {"audience":"developers","workflow":"reverse-engineering"} |
What I do
- Guide APK decompilation and analysis workflows
- Identify classes, methods, and fields relevant to patching
- Understand app architecture and component relationships
- Find detection mechanisms, SSL pinning, root detection, and other security features
- Document findings for patch development
When to use me
Use this skill when:
- Analyzing a new APK to understand its structure
- Finding the right class/method to patch
- Investigating why a patch isn't working
- Documenting app internals for future contributors
- Converting between Java and smali representations
APK Analysis Workflow
1. Initial APK Inspection
aapt dump badging app.apk
unzip -l app.apk | grep ".dex"
apktool d app.apk -o output_dir
2. JADX Decompilation
jadx app.apk -d output_dir
jadx app.apk -d output_dir --show-bad-code --deobf
3. Key Areas to Investigate
Application Entry Points
- Main Activity (from AndroidManifest.xml)
- Application class (onCreate method)
- Content Providers
- Services
- Broadcast Receivers
Security Mechanisms
- SSL/TLS pinning (look for
CertificatePinner, TrustManager, X509TrustManager)
- Root detection (look for
su, Superuser, RootTools, Magisk)
- Emulator detection (look for
Build.FINGERPRINT, Build.MODEL, TelephonyManager)
- Integrity checks (look for
SafetyNet, PlayIntegrity, signature)
- Debugger detection (look for
Debug.isDebuggerConnected)
Feature Targets
- Network requests (Retrofit, OkHttp, Volley)
- Authentication flows
- Premium/feature gates
- Ad loading
- Analytics/telemetry
4. Finding Patch Targets
By Class Name
grep -r "isRooted" output_dir/
grep -r "sslPinning" output_dir/
grep -r "isPremium" output_dir/
By String Reference
jadx --deobf app.apk -d output_dir
grep -r "feature locked" output_dir/
By Method Usage
grep -r "methodName(" output_dir/
5. Smali Analysis
When Java decompilation fails or is unclear, analyze smali directly:
apktool d app.apk -o smali_output
6. Common Smali Patterns for Patching
Boolean method returning false
.method public isFeatureLocked()Z
.registers 2
const/4 v0, 0x0
return v0
.end method
Null return
.method public getRestriction()Ljava/lang/String;
.registers 2
const/4 v0, 0x0
return-object v0
.end method
Empty list return
.method public getBlockedFeatures()Ljava/util/List;
.registers 3
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
return-object v0
.end method
Skip conditional branch
# Original: if-eqz v0, :cond_10
# Patched: goto :cond_10
# Or: const/4 v0, 0x1
Documentation Guidelines
When documenting findings, create files in docs/<appname>/:
ssl-pinning.md — SSL pinning implementation details
root-detection.md — Root detection mechanisms
emulator-detection.md — How the app detects emulators
debugging-journey.md — Step-by-step debugging notes
apk-structure.md — Overall app architecture
Include:
- Class names (both Java and Dalvik formats)
- Method signatures
- Key strings used for detection
- Failed patch attempts and why they failed
- Useful smali patterns discovered
Tools Reference
JADX CLI Commands
jadx app.apk -d jadx_output
jadx app.apk -d jadx_output --deobf
jadx app.apk -d jadx_output --show-bad-code
jadx app.apk --output-format jar -d jadx_output
jadx app.apk -d jadx_output --cls com.example.MyClass
jadx app.apk -d jadx_output --deobf
find jadx_output/ -name "*.java" | xargs grep -l "ClassName"
find jadx_output/ -name "*.java" | xargs grep -l "methodName("
find jadx_output/ -name "*.java" | xargs grep -l "string to find"
jadx app.apk -d jadx_output
cat jadx_output/resources/AndroidManifest.xml
find jadx_output/ -name "strings.xml"
Common JADX CLI Analysis Patterns
find jadx_output/ -path "*/com/example/*" -name "*.java"
find jadx_output/ -name "*.java" | xargs grep -l "implements SomeInterface"
find jadx_output/ -name "*.java" | xargs grep -l "extends SomeBaseClass"
find jadx_output/ -name "*.java" | xargs grep -n "methodName"
find jadx_output/ -name "*.java" | xargs grep -n "ClassName"
Command Line Tools
jadx — Java decompiler (CLI)
apktool — APK decompiler/recompiler
aapt — Android Asset Packaging Tool
dex2jar — Convert dex to jar
jd-gui — Java decompiler GUI
Tips
- Always check multiple APK versions — class names may change
- Look for obfuscated names (a.b.c()) — track by usage patterns
- Check for reflection-based loading — patches may need to target multiple classes
- Note the app's minimum SDK version for compatibility
- Document everything — future you (or contributors) will thank you