· Droidwatch Security Research team · 9 min read · Static Analysis Deep-Dives APK analysis Mobile security APK triage
🌐 Leer en español → 🌐 Ler em português →

APK vs AAB vs XAPK: Android Package Formats Compared

What APK, AAB, XAPK, APKS and DEX files are, how each one is built, installed and signed, and what each format means for security analysis.

APK vs AAB vs XAPK: Android Package Formats Compared

An Android app can reach an analyst in at least five forms: an APK, an Android App Bundle (AAB), an XAPK from a third-party store, an APK set (APKS) built with Google's tooling, or a loose DEX file. They are not interchangeable. Each is built differently, installed differently and signed differently, and each hides or exposes different parts of the app.

The APK is what a device installs; the AAB is what a developer uploads to Google Play, which turns it into APKs; XAPK is a ZIP container used by third-party stores to carry one or more APKs and optional data; APKS is the container bundletool produces, holding split APKs for every supported device configuration; and DEX is the compiled code alone.

The formats at a glance

Format What it is Who produces it Installable directly Typical source for an analyst
APK (.apk) Android package: code, resources, manifest, signature Build tools; Google Play generates it from an AAB Yes Devices, websites, links in messages
AAB (.aab) Publishing format uploaded to Google Play Android Studio, Gradle, bundletool No; converted to APKs first The developer's own build pipeline
XAPK (.xapk) ZIP archive with a base APK, optional split APKs, optional OBB data and a manifest.json Third-party stores Not by opening the file; needs a helper app or adb Third-party APK sites
APKS (.apks) APK set archive generated by bundletool from an AAB bundletool build-apks With bundletool install-apks Internal testing, CI pipelines
DEX (.dex) Compiled Dalvik bytecode only The compiler, inside an APK No Extracted from an APK or dropped by malware at runtime

APK: what the device installs

An APK is a ZIP archive with a fixed structure: AndroidManifest.xml in binary form, one or more classes.dex files with the compiled code, resources, native libraries under lib/, assets, and the signature. It is the only format that can be installed by opening a single file.

Since Android 5.0, an app can also be installed as several APKs at once: a base APK and split APKs for specific screen densities, CPU architectures, languages or features. A device that installed an app from Google Play may hold several APK files for that one app. Extracting only the base APK from such a device gives an incomplete picture: native code for the device's architecture, for example, may live in a split.

For analysis, a single APK is the simplest case. All of the app's installable code and resources are in one file, under one signature. The checks for a single APK are described in how to check if an APK is safe before installing it.

AAB: what developers upload to Google Play

Google's documentation describes the Android App Bundle as "a file (with the .aab file extension) that you upload to Google Play". It organizes the app's code and resources into modules: a base/ module that is always present and optional feature modules. Unlike an APK, it stores each module's manifest in a separate manifest/ directory and carries protocol buffer files, such as BundleConfig.pb, that describe the bundle to the store.

Google Play uses the bundle to generate the APKs that are served to users: the base APK, feature APKs, configuration APKs and, for devices that do not support split APKs, multi-APKs. Google announced in June 2021 that new apps on Google Play would have to be published as app bundles from August 2021, and that Play App Signing is required for app bundles.

Two consequences matter for security work:

For a team that builds its own app, the AAB is the natural artifact to scan in the release pipeline, before it reaches the store. Scanning APKs in CI/CD covers that setup.

APKS: the bundletool container for split APKs

When bundletool converts an app bundle into APKs, it places them in what its documentation calls an APK set archive, with the .apks extension. The command bundletool build-apks generates the set for every device configuration the app supports, and bundletool install-apks deploys it to a connected device. With --mode=universal, bundletool builds a single APK that, according to its documentation, includes all of the app's code and resources and is compatible with every supported configuration, at the cost of size.

APKS files mostly appear in development and testing. A universal APK built from the bundle is usually the most convenient artifact for analysis, because it puts the code of all fused modules into one file.

XAPK: the third-party store container

XAPK is not an Android standard format. The OWASP Mobile Application Security Testing Guide describes it as a ZIP archive used by third-party stores that typically includes a base APK, optional split APKs generated from an Android App Bundle, optional OBB data files, and a manifest.json file describing the contents.

Because it is a ZIP file, an XAPK can be extracted with standard tools. The MASTG notes that there is no reliable or supported way to convert its split APKs into one universal APK; the splits are installed together with adb install-multiple, and any OBB data is pushed to the device separately.

XAPK files carry a specific risk profile:

Comparing the signing certificate of each APK inside against the official app's certificate is the most direct way to tell a faithful copy from a modified one.

DEX: the code without the package

A DEX file is compiled Dalvik bytecode, the code that the Android Runtime (ART) interprets or compiles to native code. A base APK of an app with code contains at least one classes.dex; large apps contain several. Configuration splits usually contain no code. A DEX file has no manifest, no resources and no signature of its own.

Analysts meet loose DEX files in two situations: when extracting code from an APK for focused analysis, and when malware downloads or decrypts a DEX file at runtime and loads it through DexClassLoader or InMemoryDexClassLoader (dynamic code loading). In the second case, the DEX file is often the second stage that the original APK did not show in readable form. Without the manifest, the analysis can establish what the code does, but not which permissions or components it was declared with.

Signing across formats

Format How it is signed What a certificate check shows
APK JAR signing (v1) and/or APK Signature Scheme v2, v3 or v3.1; verified with apksigner verify --print-certs The certificate of whoever signed that APK
AAB JAR signing with the upload key; verified with jarsigner -verify or keytool -printcert -jarfile. With Play App Signing, Google re-signs the generated APKs with the app signing key The upload certificate, which usually differs from the certificate on users' devices
APKS Each APK in the set is signed with the key passed to bundletool (a debug key if none is given); the archive itself is not signed The certificate of each APK
XAPK The container is not signed; each APK inside is The certificate of each APK, which may differ from the official one
DEX Not signed on its own Nothing. A DEX extracted from an APK is covered by that APK's signature; one downloaded at runtime has none
Situation Best artifact Why
Suspicious app received by link or found on a device The APK, plus every split if the app was installed as splits It is what was delivered
App downloaded from a third-party store as XAPK Every APK inside the XAPK The modification can be in any of them
A team's own app before release The AAB, or a universal APK built from it Catches issues before the store sees them
Second stage dropped by malware The DEX or APK recovered from the device or the network The first stage often does not contain it in readable form

Droidwatch accepts .apk, .aab, .xapk and .dex uploads for Android, and .ipa for iOS, and analyzes them statically, without executing them. Each APK extracted from an XAPK can also be uploaded on its own. For an APK, the report covers the package identity, the signing certificate, permissions and components, bytecode, native libraries, third-party SDKs and network indicators, with findings mapped to MITRE ATT&CK Mobile and a risk score from 0 to 100 where higher is worse. A standalone DEX file has no manifest or signature, so those sections do not apply to it. What each part of the report contains is described in analyze an APK online: inside a Droidwatch report, and the other tools that handle these formats are compared in APK analysis tools compared.

Frequently asked questions

What is the difference between APK and AAB? An APK is the package that Android installs. An AAB is the publishing format developers upload to Google Play, which generates optimized APKs from it for each device. New apps on Google Play have had to be published as AABs since August 2021.

What is an XAPK file? A ZIP archive used by third-party stores that typically contains a base APK, optional split APKs, optional OBB data and a manifest.json. It is not an Android standard format and is installed with a helper app or with adb install-multiple.

Can an AAB be installed on a phone? Not directly. It has to be converted into APKs first, by Google Play or by bundletool, which can build an APK set (.apks) or a single universal APK.

Is XAPK safe? The format is a container; safety depends on the APKs inside and where they came from. XAPK files come from outside Google Play, so each APK inside should be checked, including its signing certificate against the official app.

Which format should be analyzed for security? The one that was delivered: the APK, or all APKs in a split installation or XAPK. For a team's own app, the AAB or a universal APK built from it, before release.

Threat Research

Droidwatch's research team analyzes Android & iOS malware — banking trojans, spyware, droppers and overlay kits — and writes up the static and dynamic signals that give them away. Every post is grounded in real platform output.

Analyze your first app free — drag an APK or iOS .ipa onto the homepage for a full static report in a few minutes. Get started free