Format:AXML
| Platforms | Platform:Android |
|---|---|
| Magic | 03 00 08 00 (RES_XML_TYPE, header size 8), then uint32 total size |
| Extensions | .xml inside an APK |
| Endianness | little-endian |
| On this wiki | Facts · Code · Notes · Topics |
Android binary XML (compiled AndroidManifest.xml and res/**/*.xml in an APK): a RES_XML_TYPE chunk (03 00 08 00) holding a string pool, an optional resource-id map and start/end element and namespace chunks.
Chunk structure
Every chunk starts with a ResChunk_header {uint16 type, uint16 headerSize, uint32 size}. The file is one RES_XML_TYPE (0x0003) chunk; its children are, in order: a string pool (0x0001), optionally a resource map (0x0180: an array of uint32 Android resource ids, one per leading string of the pool, giving attribute names such as android:name their ids like 0x01010003), then namespace and element chunks (0x0100 to 0x0104). Chunk type values: see the enum fact on this subject.
String pool
Header after the chunk header: stringCount, styleCount, flags (bit 0 SORTED, bit 8 UTF8), stringsStart, stylesStart (offsets from the chunk start), then stringCount uint32 offsets (from stringsStart). UTF-16 strings: uint16 length in code units (if the high bit is set a second uint16 follows, length = ((first & 0x7FFF) << 16) | second), the characters, a 0x0000 terminator. UTF-8 strings: length in UTF-16 units, then length in bytes (each one byte, or two bytes when the 0x80 bit is set), the bytes, 0x00.
Element chunks
After the 8-byte header a node header: uint32 lineNumber, uint32 comment string index (0xFFFFFFFF = none). START_ELEMENT then has: ns index, name index, uint16 attributeStart (0x14), uint16 attributeSize (0x14), uint16 attributeCount, uint16 idIndex, classIndex, styleIndex; then each attribute is 20 bytes: ns, name, rawValue (string index or 0xFFFFFFFF), Res_value {uint16 size = 8, uint8 res0, uint8 dataType, uint32 data}. Data types (reference 0x01, string 0x03, int dec 0x10, hex 0x11, boolean 0x12 with 0xFFFFFFFF = true, colors 0x1C-0x1F ...) are in the enum fact.
Obfuscation seen in the wild
Unverified (from general experience, not from the parser source): packers and malware corrupt AXML on purpose with wrong chunk sizes, inconsistent string counts, unknown chunk types between elements, or attributes whose name string is empty but whose resource-map id is valid (resolve the name from the id). A tolerant reader trusts chunk sizes and the resource map, not declared counts.
Read in source: Apktool takes attribute names from the resource map and resource table in preference to the string pool (a pool name may be wrong or arbitrary), skips RES_NULL chunks inside the document, and ignores chunk types outside 0x0100-0x017F; see the Apktool facts on this page. A tolerant reader therefore walks by chunk headerSize/size, not by counts.
Tools
apktool (decodes AXML to text and rebuilds; BinaryXmlResourceParser and BinaryResourceParser in apktool-lib), jadx (jadx-core xmlgen package: BinaryXMLParser, ResTableBinaryParser), androguard/axml (Python), aapt2 dump xmltree. In an AAB the manifest and layouts are protobuf XML instead; see Format:Android App Bundle.
Code & repositories
- https://github.com/androguard/axml @
5fdb362964fb98ff33631d5181c584121fa9b1b1· license: Apache-2.0
Python parser for Android binary XML (AXML) and resources
Tested on: source read, not run: source reading · checked 2026-10-18; last activity 2025-09-24 - https://android.googlesource.com/platform/frameworks/base @
1cdfff555f4a21f71ccc978290e2e212e2f8b168· license: Apache-2.0 (read from NOTICE)
AOSP frameworks/base; libs/androidfw/include/androidfw/ResourceTypes.h defines all chunk, string pool, Res_value and ResTable_* structures; ResourceTypes.cpp has the string pool decoder.
Tested on: source read, not run · checked 2026-10-19; last activity 2025-03-27 - https://github.com/iBotPeaches/Apktool @
fd9d5d4dc7e45fa7f984698ded7a03c554d0a7b3· license: Apache-2.0
Apktool: BinaryXmlResourceParser, BinaryResourceParser and ResChunkHeader under brut.apktool/apktool-lib/src/main/java/brut/androlib/res decode binary XML and resources.arsc.
Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-17; Note: the latest release ships binaries; the wiki links only the source, never the binaries - https://github.com/skylot/jadx @
c4c45fde27b4f3386dc2ff016ff187229a60a716· license: Apache-2.0
jadx: jadx-core/src/main/java/jadx/core/xmlgen has ParserConstants, BinaryXMLParser and ResTableBinaryParser.
Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-14; Note: the latest release ships binaries; the wiki links only the source, never the binaries