Formats and limits
Systems
| System | Architecture | What it includes | Requirements |
|---|---|---|---|
| macOS | arm64 (Apple silicon) | ngr |
macOS 12 or later |
| Linux | x64 | ngr |
glibc 2.35 or later, ICU and OpenSSL 3 |
| Windows | x64 | ngr.exe |
Tested on Windows 11 |
The three executables are checked with the same battery: every command, the three walkthroughs of the
“quick start” and thousands of consecutive starts. What ngr writes does not depend on
the system, with the exceptions in “Differences between systems”.
There is no version for Macs with an Intel processor, nor for Linux or Windows on arm64, nor for Linux with musl (Alpine).
Files it reads
ngr recognizes a file by its structure, not by its extension. ngr identify
distinguishes five:
| Structure | What it is | Usual extensions |
|---|---|---|
| dex | A single dex file | .dex |
| apk with dex at the root | A normal apk. Also a .jar with dex |
.apk, .jar |
| apk without dex | An apk with AndroidManifest.xml and no classes*.dex, like the resource modules of a bundle |
.apk |
| apk bundle | A zip of apks | .xapk, .apkx, .apkm |
| bundletool bundle | A zip with BundleConfig.pb or toc.pb at the root |
.aab, .apks |
Which commands accept each one is told by the verbs: line of ngr identify.
Dex
| Versions it reads | 035, 037, 038, 039 and 040 |
|---|---|
Versions assemble writes |
From 035 to 041, depending on --android-api |
| Several dex files | disassemble, dump, list and decompile read all of those in an apk, in order |
| A dex inside an apk | app.apk/classes2.dex, in .apk, .xapk and .apkx |
ngr does not read dex version 041. ngr assemble --android-api 35 writes one, and the commands that read dex
reject it with Unsupported DEX version '041'.
It does not read odex, vdex or oat files either.
Two limits with code that uses invoke-custom or method handles:
ngr assembledoes not assemble theinvoke-customorconst-method-handleinstructions. It says so withCallSite operands (invoke-custom / const-method-handle) are not implemented.ngr dumpdoes not dump a dex that has those sections, or one with hidden api restrictions.
disassemble, list and decompile do read those dex files.
Signing
| Schemes it signs | v1 (JAR), v2, v3 and v3.1 with rotation, and v4 (.idsig) |
|---|---|
| Schemes it verifies | The same ones, and the source stamp (SourceStamp) |
| Keystores | PKCS#12 (.p12, .pfx) |
| Rotation | Certificate lineages: create, extend, read and change capabilities |
It does not read JKS keystores or keys in separate PEM or PKCS#8 files, and it does not sign with keys on an external device.
Resources
decode and build work with the binary resource table (resources.arsc) and the compiled xml files of an apk.
The resources of the Android platform are resolved with the tables that ngr ships. You cannot add a vendor's.
refactor and protect need the apk to have resources.arsc.
Decompiler
| Input | dex, apk and xapk |
|---|---|
| Output | Java, level 7, 8, 11, 17, 21 or 25 |
| Platform | A model of the Android API included in ngr, up to level 36, or your android.jar |
| Names | Debug information, Kotlin metadata, R8 or ProGuard mapping.txt, and --deobf |
The output is always Java. Code written in Kotlin is decompiled to the Java equivalent to its bytecode.
Differences between systems
- Uppercase in file names. On macOS and Windows, the file system usually does not distinguish case. If an apk
has two entries that differ only in that,
decodecannot write both and warns about it. On Linux both fit. assemble --dialect jfreads a folder in the order in which the file system lists it, so its output may depend on the volume. With--dialect smali, the default, the same input always gives the same bytes.- The debug key is stored in the configuration folder of each system (“The debug key”).
- The output encoding on Windows.
ngr.exewrites UTF-8 when its output goes to a file or a pipe (“Installation”).
Beta versions
The 0.x.y versions are beta versions. We will try not to, but from one to the next the commands, the options, the exit codes and the output formats may change. “Release notes” says what changes in each version.
What ngr does not do
- Install applications or talk to a device.
- Build apks from an
.aab. - Compile resources or code from an Android project.
- Convert dex into
.classfiles. - Decompile to Kotlin.
“Behavior differences” says which tool does each thing.