Reverse Engineeringandroiddexdisassemblerassemblersmalibaksmali

libsmali-java

libsmali-java provides libraries for smali/baksmali, an assembler and disassembler for Android's dex format used by Dalvik, Android's Java VM. It supports full dex format functionality including annotations, debug info, and line info.

Description

libsmali-java is a Java library package containing the core components for smali and baksmali tools. These tools are essential for working with Android's dex (Dalvik Executable) format, enabling developers and security researchers to disassemble and reassemble Android application bytecode.

The package supports the complete feature set of the dex format, including annotations, debug information, and line numbers. This makes it valuable for reverse engineering Android APKs, modifying application behavior, or analyzing malware.

Use cases include deodexing odex/oat files, disassembling dex files for code inspection, and assembling smali code back into dex files for repackaging modified APKs.

How It Works

smali/baksmali operates on Android's dex format using syntax based on Jasmin/dedexer. baksmali disassembles dex bytecode into human-readable smali assembly code, preserving annotations, debug info, and line information. smali performs the reverse, assembling smali files back into dex bytecode. The tools leverage ANTLR3 for parsing and support full dex specification features.

Installation

bash
sudo apt install libsmali-java

Flags

--help,-h,-?Show usage information for baksmali
--version,-vPrint the version of baksmali and then exit
-h,-?,--helpShow usage information for smali
-v,--versionPrint the version of smali and then exit

Examples

Displays help and usage information for baksmali
baksmali -h
Deodexes an odex/oat file (use 'baksmali help deodex' for details)
baksmali deodex
Disassembles a dex file (use 'baksmali help disassemble' for details)
baksmali disassemble
Prints an annotated hex dump for a dex file (use 'baksmali help dump' for details)
baksmali dump
Lists various objects in a dex file (use 'baksmali help list' for details)
baksmali list
Displays help and usage information for smali
smali -h
Assembles smali files into a dex file (use 'smali help assemble' for details)
smali assemble
Updated 2026-04-16kali.org ↗