Format:APEX
| Platforms | Platform:Android |
|---|---|
| Magic | 50 4B 03 04 (ZIP) |
| Extensions | .apex, .capex |
| On this wiki | Facts · Code · Notes · Topics |
Android Pony EXpress package (.apex, compressed .capex): a ZIP holding apex_manifest.pb (or .json), apex_pubkey, an AndroidManifest.xml stub and apex_payload.img, an ext4 filesystem image with dm-verity that apexd mounts under /apex/<name>. Used for updatable system modules.
Layout
Per the AOSP system/apex documentation (docs/README.md): the APEX is a ZIP whose files are stored uncompressed and located at 4 KB boundaries. Entries:
apex_manifest.pb(protobufapex.proto.ApexManifest; older builds usedapex_manifest.json): package name and version.AndroidManifest.xml: minimal Format:AXML so APK tools (aapt, PackageManager, Play) can read name/version.apex_payload.img: an ext4 image backed by dm-verity (hash tree and metadata built with libavb; a vbmeta descriptor is appended). Mounted through a loop device; the payload is not parsed by apexd.apex_pubkey: public key that verifies the image; must match the key of the same APEX in the built-in partition.
The APEX is additionally APK-signed (see Format:APK Signing Block).
ApexManifest fields
name=1, version=2 (int64), preInstallHook=3, postInstallHook=4 (deprecated), versionName=5, noCode=6, provideNativeLibs=7, requireNativeLibs=8, jniLibs=9, requireSharedApexLibs=10, provideSharedApexLibs=11, capexMetadata=12 (originalApexDigest=1), supportsRebootlessUpdate=13, vndkVersion=14, vendorBootstrap=15 (deprecated), bootstrap=16.
Compressed APEX (.capex)
A ZIP with original_apex (the whole uncompressed .apex, deflate level 9) plus stored copies of apex_manifest.pb, AndroidManifest.xml and apex_pubkey. At boot original_apex is decompressed to /data/apex/decompressed/<name>@<version>.apex and hard-linked into /data/apex/active/.
Reversing notes
- Unzip, then mount or extract
apex_payload.imgas ext4 (for example with debugfs or 7-Zip); inside arebin/,lib64/,javalib/*.jar,etc/. Runtime paths are/apex/<name>/..., so/system/lib64/libfoo.somay really live in an APEX. - Inside an AAB (bundle type APEX) the manifest is
root/apex_manifest.pband images are listed inapex.pb, see Format:Android App Bundle.
Unverified: payload filesystem can also be f2fs or erofs on recent releases; only ext4 is stated in the document read.
Code & repositories
- https://github.com/google/bundletool @
586a43a450712a1067f3d92cf7574dee68226302· license: Apache-2.0
Official AAB tool; protobuf schemas for BundleConfig, targeting and the .apks toc.pb
Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2025-12-15; Note: the latest release ships binaries; the wiki links only the source, never the binaries