Format:OAT
| Platforms | Android ART |
|---|---|
| Magic | 6F 61 74 0A + ASCII version ("oat\n131\0") |
| Extensions | .oat, .odex |
| On this wiki | Facts · Code · Notes · Topics |
Android Runtime's ahead-of-time compiled form of DEX code (.oat, and the .odex files next to an APK): since Android 8.0 an ELF shared object whose oatdata symbol points at a header with magic "oat\n" and a three-digit version (064 = Android 6.0.1, 079 = 7.0, 088 = 7.1.x, 124/126 = 8.0, 131 = 8.1, 138 = 9). OAT files are produced and loaded by the ART runtime of Platform:Android.
Container
OAT data sits inside an Format:ELF (Executable and Linkable Format) file (all versions covered here; the ELF is produced by dex2oat). The dynamic symbols oatdata (start of the OAT header, in a read-only segment), oatexec (start of the compiled code) and oatlastword locate the parts. The raw oat\n header is therefore not at file offset 0: find the ELF symbol oatdata and read from its address. Parsers (LIEF) concatenate oatdata and oatexec into one buffer before parsing.
OAT header
magic[4] oat\n; version[4] ASCII digits + NUL (064\0); adler32_checksum; instruction_set (0 none, 1 arm, 2 arm64, 3 thumb2, 4 x86, 5 x86_64, 6 mips, 7 mips64); instruction_set_features_bitmap; dex_file_count; (from version 131: oat_dex_files_offset); executable_offset; interpreter_to_interpreter_bridge_offset; interpreter_to_compiled_code_bridge_offset; jni_dlsym_lookup_offset; quick_generic_jni_trampoline_offset; quick_imt_conflict_trampoline_offset; quick_resolution_trampoline_offset; quick_to_interpreter_bridge_offset; image_patch_delta (i32); image_file_location_oat_checksum; image_file_location_oat_data_begin; key_value_store_size; then the key/value store (NUL-terminated strings).
Keys in the store: image-location, dex2oat-cmdline, dex2oat-host, pic, has-patch-info, debuggable, native-debuggable, compiler-filter (for example speed, speed-profile, quicken, verify), classpath, bootclasspath, concurrent-copying, compilation-reason. The dex2oat-cmdline string tells how the file was built.
After the header
Per DEX file: OatDexFile {location size, location string, location checksum, dex file offset}, an embedded copy of the DEX (before Android 8.1 the DEX is copied into the OAT; from 8.1 it may live in a Format:VDEX), and type lookup tables (str_offset, data, next_pos_delta, 8 bytes each, from OAT 079). Class records: OatClass status (mirror::Class status, 10 = initialized) and type (0 all compiled, 1 some compiled with bitmap, 2 none compiled) followed by method offsets; each compiled method is preceded by an OatQuickMethodHeader: OAT 064 has mapping_table_offset, vmap_table_offset, gc_map_offset, frame_size, core_spill_mask, fp_spill_mask, code_size; OAT 079 drops mapping and gc map; OAT 124+ adds method_info_offset.
Versions by Android release
| OAT | Android |
|---|---|
| 064 | 6.0 / 6.0.1 |
| 079 | 7.0 |
| 088 | 7.1.x |
| 124 (LIEF comments say 126) | 8.0 |
| 131 | 8.1 |
| 138 | 9 |
Later releases (10+) bump the number further and add boot images and compact DEX; unverified here. Companion files: Format:ART image (.art) and Format:VDEX (.vdex).
ART main (AOSP commit 6484611f) has OAT version 259 (Fact:OAT/magic/OAT version 259 in ART main), and its key/value store adds bootclasspath-checksums and apex-versions to the keys listed above. The version rises with every layout or semantic change, so parsers should read it and refuse unknown numbers. Unverified: the release-to-number mapping for Android 10 to 15.
Code & repositories
- https://github.com/lief-project/LIEF @
2795838f5f33efbc10f071d194c44197a86a36d8· license: Apache-2.0 (declared by the contributor for the files used; GitHub reports Apache-2.0 (read from LICENSE; GitHub's API was busy) for the repository)
LIEF: parser and rewriter for ELF, PE, Mach-O, DEX, OAT, VDEX and ART; src/DEX, src/OAT, src/VDEX, src/ART Structures.hpp give the header layouts per Android release
Tested on: source read, not run: source read only · checked 2026-10-18