Format:resources.arsc
| Platforms | Platform:Android |
|---|---|
| Magic | 02 00 0C 00 (RES_TABLE_TYPE, header size 12), uint32 size, uint32 package count |
| Extensions | .arsc |
| Endianness | little-endian |
| On this wiki | Facts · Code · Notes · Topics |
The compiled resource table of an Android app: a RES_TABLE_TYPE chunk (02 00 0C 00) with a global string pool and one package per resource package, each with type and key string pools, TypeSpec and Type chunks that map 0xPPTTEEEE resource ids to values.
Structure
Same chunk framework as Format:AXML (chunk header {type, headerSize, size}). The table: header (12 bytes: chunk header + uint32 packageCount), a global value string pool (0x0001), then packageCount package chunks (0x0200).
A package chunk: header with uint32 id (0x7F for the app, 0x01 for the framework), 128 UTF-16 characters of package name, offsets to the type-name and key-name string pools, then the pools, then for each resource type (anim, drawable, layout, string, ...) a TypeSpec chunk (0x0202: one uint32 of config-change flags per entry) and one or more Type chunks (0x0201: per-configuration entry offsets and entries, plus a ResTable_config describing locale, density, screen size, SDK version). Library (0x0203) chunks list shared-library package ids; overlayable and staged-alias chunks are 0x0204-0x0206.
Resource ids
id = 0xPPTTEEEE: package id, type id (1-based index in the type string pool), entry index. R.java constants (and public.xml) give the same numbers, so 0x7f0b0012 is entry 0x12 of type 0x0b in the app package. Entries hold either a Res_value (same layout and data types as AXML attributes) or a map (styles, plurals, attrs).
Overview
Other localization containers: Format:GNU gettext message catalog (MO) (gettext .mo), Format:Qt translation (QM), Format:ICU data file (icudt) and Format:Windows message table resource (RT MESSAGETABLE).
Reading order and chunk types
Chunk types seen in a table (all from ResourceTypes.h): 0x0001 string pool, 0x0002 table, 0x0200 package, 0x0201 type, 0x0202 typeSpec, 0x0203 library, 0x0204 overlayable, 0x0205 overlayable policy, 0x0206 staged alias; Apktool also knows 0x0207 and 0x0208, which the AOSP header at the cited commit lacks. The table holds one global string pool of values, so a Res_value of type STRING (0x03) indexes that pool, while each package has its own type-name and key-name pools. A package chunk's headerSize tells whether the optional trailing header fields exist; always step by headerSize and size, not by struct size.
A Type chunk's ResTable_config carries the qualifiers of the directory (values-de, drawable-xxhdpi-v26, ...): language/country, density, screen size, sdkVersion. One resource id can have many entries, one per Type chunk of the same type id, and the runtime picks the best match for the device configuration.
Unverified: aapt2 may emit a type in several Type chunks with different sparse/offset16 choices per configuration; check each chunk's flags separately.
Code & repositories
- 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
Pitfalls
Obfuscators rename keys to short strings; DEX code then uses numeric ids and the table is the only map from id to file path (res/a1.xml). Newer tables use three space-saving forms, all read in AOSP ResourceTypes.h (see the facts on this page): Type chunks with FLAG_SPARSE (0x01, platform O and later, entries listed as {idx, offset/4} and sorted by idx), FLAG_OFFSET16 (0x02, uint16 offsets times 4, 0xFFFF = absent) and compact entries (entry flag 0x0008, 8 bytes with the dataType in the high byte of flags). Never assume a fixed uint32 offset array or a fixed entry size; check the Type chunk's flags and each entry's flags. Real-world tables also break the rules (nonzero reserved field, repeated sparse indexes), so jadx and Apktool are tolerant readers.
Source: androguard/axml (ARSC parser).