pyjadx
Python bindings for JADX via JPype. Decompile Android APK and DEX files to Java source from Python.
from pyjadx import Jadx
with Jadx("app.apk") as jadx:
for cls in jadx.classes:
print(cls.full_name)
print(cls.code)
Why pyjadx?
JADX is the leading open-source Android decompiler — it produces clean Java/Kotlin source from Dalvik bytecode, preserving class hierarchies, generics, exception handling, and annotations. pyjadx brings this into Python without subprocess overhead: JADX runs in-process via JPype.
Install
Requirements: JDK 11+ (JADX JARs are downloaded automatically on first use).
Quick start
from pyjadx import Jadx
with Jadx("app.apk") as jadx:
# All top-level classes (inner classes via cls.inner_classes)
for cls in jadx.classes:
print(cls.full_name, len(cls.methods), "methods")
# Search by fully qualified name
main = jadx.search_class("com.example.MainActivity")
if main:
print(main.code)
# Method-level decompilation
for method in main.methods:
print(f"{method.name}: {method.code}")
# Cross-references
for method in main.methods:
print(f"{method.name} called by: {[c.name for c in method.callers]}")
# Package navigation
for pkg in jadx.packages:
print(pkg.name, len(pkg.classes), "classes")
| Format | Example |
|---|
| APK | Jadx("app.apk") |
| DEX | Jadx("classes.dex") |
| Multi-DEX APK | Handled transparently — all classes merged |
API reference
Jadx(path, *, threads=None, mode="auto", code_cache=False)
Main entry point. Use as a context manager or call load()/close() manually.
Properties:
Methods:
JavaClass
JavaMethod
JavaField
JavaPackage
Escape hatch
Every wrapper exposes its underlying JADX Java object via .java. This lets you call any JADX API we haven't wrapped yet:
with Jadx("app.apk") as jadx:
cls = jadx.search_class("com.example.Foo")
# Call JADX Java API directly
code_info = cls.java.getCodeInfo()
JVM coexistence
pyjadx coexists with other JPype consumers (e.g., PyGhidra) in the same process. If a JVM is already running, pyjadx.start() adds JADX JARs to the existing classpath. If not, it starts one.
import pyghidra
pyghidra.start() # starts JVM for Ghidra
import pyjadx
pyjadx.start() # adds JADX JARs to existing JVM — no conflict
Configuration
Custom JADX installation:
# Via environment variable
# export JADX_HOME=/opt/jadx
# Or at runtime
import pyjadx
pyjadx.start(jadx_home="/opt/jadx")
JAR caching: JADX JARs are auto-downloaded from Maven Central on first use and cached at ~/.pyjadx/jars/<version>/.
License
MIT