Arsc: Decompiler

A minimal ARSC decompiler in Python pseudocode:

def read_string_pool(data, offset):
    # read chunk header, string count, style count, offsets
    # return list of strings

def parse_resources(arsc_data): pos = 0 while pos < len(arsc_data): chunk_type = read_int(arsc_data, pos) if chunk_type == RES_STRING_POOL: string_pool = read_string_pool(arsc_data, pos) elif chunk_type == RES_TABLE_PACKAGE: pkg_id, pkg_name = read_package(arsc_data, pos) elif chunk_type == RES_TABLE_TYPE_SPEC: # read type spec (configurations) elif chunk_type == RES_TABLE_ENTRY: value = read_entry(arsc_data, pos, string_pool) emit_xml_for_config(pkg_name, type_name, entry_name, value) pos += chunk_size arsc decompiler

The hardest part is correctly reassembling the many‑to‑many mapping between entry IDs, configuration qualifiers, and actual values into a coherent set of XML files. A minimal ARSC decompiler in Python pseudocode: def

arsc dump resources.arsc --pretty > arsc_dump.txt

The --pretty flag decodes resource IDs into <public> references if possible. You'll see output like: The --pretty flag decodes resource IDs into &lt;public&gt;

Package 'com.example.app' (id=0x7F)
  Type 'layout' (id=0x01)
    Entry 'activity_main' (id=0x0000) -> layout/main.xml
  Type 'string' (id=0x03)
    Entry 'app_name' (id=0x0000) -> "My App"
    Entry 'obfuscated_a' (id=0x0001) -> "Welcome"

ARSC is a binary file format used inside Android APKs (specifically resources.arsc). It contains the application’s resource table—a compiled index of all resources (layouts, strings, images, dimensions, styles, themes, etc.) mapped to their integer IDs. An ARSC decompiler (more accurately, a resource decoder or parser) is a tool that reverses this binary format back into human‑readable forms, typically XML or a plain‑text resource directory.

Unlike Java/DEX decompilers (e.g., Jadx, CFR), which recover source code, ARSC decompilers focus on restoring the resource structure: res/values/strings.xml, res/values/colors.xml, res/layout/main.xml, etc.