Behavior differences
The “equivalents” say which command corresponds to which. This page says where the result, or the way of working, is not the same.
Those that apply to all commands
ngrnever writes over the input.apksigner signwithout--outsigns the apk in place and overwrites it.ngr signalways writes a new file,app_signed.apk.ngrnever overwrites an output without-f. Each command has a default output name, next to the input and with a suffix (“Files each command writes”).- Exit codes mean the same in all commands. 0, 1 and 2 are success, failure and usage error, and 3 is a negative verdict (“Output and exit codes”). Each of the other tools has its own.
- Options are written the same way in all commands. Always
--option value, with-ofor the output and-fto overwrite. APKEditor uses a single dash (-clean-meta), zipalign uses positional arguments, and apksigner usestrueorfalsevalues wherengrhas--no-v1. - One executable, no Java startup. You do not have to type
java -jar, or have a JDK, or the Android SDK.
Compared with Apktool
The decode tree is not Apktool's
Both decode an apk into a folder, but with different formats. The ngr decode tree has the resources in
resources/package_1/res/, the smali in smali/classes/ and the rest in root/
(“The decode tree”). Apktool's has another layout and its apktool.yml file.
They are not interchangeable: ngr build does not build an Apktool folder, and apktool b does not build an
ngr one. If you have an Apktool project with changes, keep going with Apktool or decode again with ngr and
repeat the changes.
Other differences
ngr builddoes not use aapt2. It builds the resource table and the binary xml files itself. Apktool calls aapt2 for that.ngrhas no frameworks. Apktool can install a vendor's system resources to decode applications that depend on them.ngrships the Android resource tables and supports no others.ngr decodedoes not decode only the manifest, and does not have Apktool's options to skip the assets or to keep broken resources.- Neither Apktool nor
ngr buildsigns. Withngrthe next step isngr sign, which also aligns.
Compared with APKEditor
decode, build, merge, refactor, protect, info, resource and xml derive from APKEditor 1.4.3, and
the decode tree is its own. What changes:
- The shape of the options.
-i app.apkbecomes the plain input,-tis--typeor--format, and options take two dashes. infois split into three commands. General reports arengr info, per-resource queries (-res) arengr resource, and the xml files (-xmltree,-xmlstrings) arengr xml.- The default output names carry the
ngrsuffix:_built,_merged,_refactored,_protected. decodewrites only xml orraw. It does not have APKEditor's JSON output.- The reference version is 1.4.3. Whatever APKEditor has added or changed since is not in
ngr.
Compared with apksigner and zipalign
ngr signdoes not overwrite the apk, as already said, and does not need--out.ngr signwrites the v4 signature by default, in<output>.idsig. You remove it with--no-v4.ngr signaligns native libraries to 16 KB pages by default and realigns uncompressed entries, except with--alignment-preserved. You do not need to run zipalign first.- PKCS#12 keystores only. apksigner reads any Java keystore, such as JKS, and supports a key and a certificate
in separate files (
--key,--cert) and external key providers.ngrdoes not. A JKS is converted withkeytool -importkeystore. - Signers are opened with
--ks. Where apksigner separates signers with--next-signer, inngreach--ksopens one. Inrotate, the options of the outgoing and the incoming signer take the prefixes--old-and--new-. --debug-keydoes not exist in apksigner. It is specific to nogar (“The debug key”).ngr aligndoes not recompress. It does not have zipalign's option to recompress with Zopfli.ngr verifyanswers with exit code 3 when the apk does not verify, and leaves 1 for when it cannot read it.
The ngr verify report has the same lines as the apksigner verify one, so a script that reads them keeps
working.
Compared with smali and baksmali
disassembleandlistread all the dex files of an apk. Given an apk,ngr disassemblewrites one folder per dex (classes/,classes2/). For a single one,app.apk/classes2.dex.- Options with a
falsevalue become--no-...:--debug-info falseis--no-debug-info. assemblehas two dialects.--dialect smali, the default, and--dialect jf, which orders the dex in a different way (ngr assemble).- There is no
deodex, nor thebaksmali listlists for virtual tables, field offsets and dependencies.ngr listhasclasses,strings,fields,methods,typesanddex. - Restrictions of hidden api are not written.
ngr disassemblewarns when a dex has them and leaves them out of the smali. - The reference version is 3.0.9.
Compared with jadx
ngr decompile and jadx do the same thing, from dex to Java, with different priorities.
ngr decompile |
jadx | |
|---|---|---|
| What it reads | dex, apk, xapk | dex, apk, jar, class, aar, aab, xapk, apkm, apks and more |
| What it writes | Java | Java, and the decoded resources unless you pass --no-res |
| Code that cannot be translated | Comes out as smali in the method body, with the reason, and javac rejects the class | Depends on the decompilation mode and on --show-bad-code |
| Control flow that cannot be structured | A dispatcher loop that compiles, or smali | Depends on the decompilation mode |
| Count of what went wrong | In the header of each file, on stderr and in --report |
An error count at the end |
| Java level of the output | --java-version, from 7 to 25 |
Not selectable |
| Classes missing to compile | --stubs declares them |
It does not generate them |
| Obfuscated names | --deobf, and --mappings with an R8 or ProGuard mapping.txt |
--deobf with configurable lengths, and --mappings-path with other formats |
| Export a Gradle project | No | --export-gradle |
| Graphical interface | No | jadx-gui, on all three systems |
| Exit code 3 | Something was written as smali | There were decompilation errors |
What changes most when you go from one to the other:
ngrdoes not decode resources when it decompiles. For the resources,ngr decode.ngrhas no decompilation modes. jadx lets you choose betweenauto,restructure,simpleandfallbackfor all the code.ngrdecides method by method and only lets you choose what to do with what cannot be structured (--unstructured).- A class with a method in smali does not compile, and that is on purpose. If you want output that compiles
entirely even if some method is not faithful,
ngris not that. - jadx has extensions and configuration files.
ngrdoes not: everything goes on the command line.
We do not publish here quality figures of one decompiler against the other. Try them with your application: both say at the end how much they could not translate.
What ngr does not do
So you do not look for it:
- Install or talk to a device. That is
adb. - Read or build an
.aabfor Google Play. That is bundletool.ngr identifyrecognizes an.aab, butngr mergeworks with.xapk,.apkmand.apks. - Compile resources from an Android project, like aapt2, or Java or Kotlin code to dex, like d8.
- Convert dex into
.classor into.jar, like dex2jar. - Decompile to Kotlin. The output is Java.
- Compare two apks or compute download sizes, like apkanalyzer.
- Sign a whole folder at once.
ngr signsigns one apk per command. A shell loop solves it. - Dynamic or static analysis beyond reading: call graphs, usage search, debugging.