Dalvik

Dalvik was the virtual machine at the heart of early Android. Android applications were typically written in Java and compiled to standard Java class files, but those class files were not run directly. Instead a tool called dx converted the Java .class files into Android’s own DEX (Dalvik Executable) format, and the resulting bytecode ran on the Dalvik VM. This let Android use the Java language and ecosystem while running on a runtime designed specifically for resource-constrained mobile hardware.

The defining technical choice in Dalvik was its register-based architecture. The Android Open Source Project documentation states plainly that “the machine is register-based, and frames are fixed in size upon creation.” This contrasted with the Java Virtual Machine, which is stack-based. A register-based design uses fewer, typically more complex instructions to accomplish the same work, which the Dalvik designers favored for performance on the limited processors of early smartphones. Registers are treated as 32 bits wide for individual values, with adjacent pairs used for 64-bit values.

The DEX format itself was built for compactness. According to the AOSP documentation, .dex files “hold a set of class definitions and their associated adjunct data,” and a single DEX file can contain many classes, allowing constant pools and other shared data to be merged across an entire application rather than duplicated per class as in separate Java class files. This reduced both file size and memory footprint, important constraints on the storage- and RAM-limited devices of the era.

Dalvik shipped with the first versions of Android beginning in 2008 and defined how Android apps were packaged and executed for years. Over time Google replaced it with ART (the Android Runtime), which introduced ahead-of-time compilation of the same DEX bytecode for better performance and battery life. The DEX format itself outlived the Dalvik VM, remaining the on-device bytecode that ART continued to execute, so Dalvik’s design left a lasting imprint on the platform even after the VM that gave it its name was retired.