dex2jar
Tools to work with android .dex and java .class files
A toolkit that converts Android APK and DEX files into readable Java class files or smali text, making it easy to inspect what an Android app actually does.
dex2jar is a collection of tools for working with Android application files. When an Android app is installed, its code is stored in a file format called DEX (Dalvik Executable), which is the compiled bytecode format used by Android's runtime. dex2jar helps convert these files into a form that is easier to inspect.
The main tool, d2j-dex2jar, converts a DEX file or Android APK (the package file for Android apps) into a JAR file. A JAR file is a standard Java archive containing compiled Java class files, which can then be opened in common Java code viewers or decompilers. This makes it possible to examine what an Android application does at the code level.
The project also includes a reader and writer for DEX files directly, which allows programmatic access to the contents of a DEX file without conversion. There is also a disassembler (smali/baksmali) that converts DEX files into a human-readable text format called smali and can reassemble smali text back into DEX. This is a lower-level representation than Java source code but still far more readable than raw binary.
dex2jar is primarily used for Android security analysis and reverse engineering. Developers, security researchers, and auditors use it to inspect what code an Android application contains, which can help identify security issues, malicious behavior, or simply understand how an unfamiliar app works.
To use the main tool, you build the project, unzip the output package, and run a shell script against an APK or DEX file. The converted result appears as a .jar file. The project is licensed under Apache 2.0.
Where it fits
- Convert an Android APK to a JAR file to open it in a Java decompiler and read its source code.
- Disassemble a DEX file to human-readable smali text to inspect its low-level bytecode.
- Audit an unfamiliar Android app for security vulnerabilities or malicious behavior by examining its code.
- Read or write DEX file contents programmatically using the included DEX reader and writer library.