Merging a bundle
Many apps are not distributed as one apk but as several: a base one and others with the resources for each
language, each screen density and each architecture. A bundle is a zip with all of them. It has the extension
.xapk, .apkm or .apks, depending on where it comes from.
ngr merge joins them into a single apk.
1. See what it is
ngr identify app.xapk
file: app.xapk
structure: bundle of apks (64,842 B)
verbs: decode, merge, align, rotate, lineage, disassemble, dump, list, decompile
2. Merge
ngr merge app.xapk
wrote app_merged.apk
The merged apk carries the code and resources of all the modules.
3. Sign
The merged apk does not verify: the signatures the modules carried are not valid for the whole. Before installing it you have to sign it:
ngr sign --debug-key app_merged.apk
The signature is no longer the app author's. Android will not install it over the original app: you have to uninstall that first.
If you do not want to install it
To read the code of an .xapk you do not need to merge it. list, disassemble, dump and decompile read it
as it is:
ngr list dex app.xapk
ngr decompile app.xapk
base.apk/classes.dex
base.apk/classes2.dex
To see its package, its version or its resources you do have to merge it first: info, resource and xml ask
for an apk.
ngr merge app.xapk
ngr info app_merged.apk
Useful options
| Option | What it is for |
|---|---|
--clean-meta |
Removes the signature entries and the signing block from the merged apk, which are no longer valid anyway |
--extract-native-libs <manifest|none|true|false> |
Decides how native libraries are stored and what the manifest says about them |
--validate-modules |
Aborts if two modules of the same package have a different versionCode |
ngr merge explains them all.