Skip to content

ngr identify

Updated on 30 November 2026

Says what a file is and which ngr commands accept it. It looks at the structure, never at the extension: an apk renamed to .zip is recognized as an apk. Use it when you do not know what you have in your hands or when another command rejects a file and you want to know why. It reads the file and writes nothing.

Usage

ngr identify [options] <file>

Inputs

Input What it is
<file> The file to identify

Options

Option What it does Default
-h, --help Shows the help

What it writes

It writes no files. Everything goes to stdout. ngr recognizes five structures:

Structure What it is
dex A loose dex, with its own signature and version
apk with dex in the root An apk, and also a .jar
apk without dex A zip with AndroidManifest.xml in the root and no classes*.dex
bundle of apks A zip of apks: .xapk, .apkx or .apkm
bundletool bundle A zip with BundleConfig.pb in the root (.aab) or with toc.pb (.apks)

The output gives the name, the structure with its size, the commands that accept it and, if needed, a caveats: section with the limitations. An apk:

file: app.apk
structure: apk with dex in the root (114,280 B)
verbs: info, resource, xml, decode, refactor, protect, align, sign, verify, rotate, lineage, disassemble, dump, list, decompile
caveats:
  their exit code is a verdict on the file, not a rejection: align --check, verify
  need AndroidManifest.xml in the root (a .jar has none): info, info --resources, info --strings, resource, xml, sign, verify
  need resources.arsc, and say so when it is missing: refactor, protect
  exit 0 and print nothing when there is no resources.arsc: info --resources, info --strings, resource
  need a dex version nogar reads (035, 037, 038, 039, 040): disassemble, dump, list, decompile

caveats: warns about the commands in the verbs: list that set conditions. Each line names the condition and the commands it affects. A loose dex has no caveats::

file: handles.dex
structure: dex (v039, 1,900 B)
verbs: disassemble, dump, list, decompile

An .xapk or an .apkm is a bundle of apks. .apkm also carries a note:

file: app.apkm
structure: bundle of apks (134,482 B)
note: the '<file>/<entry>.dex' path syntax does not work on '.apkm' (nogar knows .apk, .xapk and .apkx there)
verbs: decode, merge, align, rotate, lineage, disassemble, dump, list, decompile
...

A bundletool .apks is the other bundle structure:

file: app.apks
structure: bundletool bundle (35,079 B)
verbs: decode, align, rotate, lineage
caveats:
  their exit code is a verdict on the file, not a rejection: align --check

A file that is none of the five

If ngr reads it and it is none of the five structures, it says unknown, ends with code 3 and warns with beware: about the commands that accept it anyway:

file: sample.jar
structure: unknown (2,155 B)
verbs: none - this is none of the five structures nogar knows.
beware: some verbs accept it anyway: decode, align, align --check, rotate, lineage

A .jar without classes.dex in the root, any zip and a text file give this answer.

Examples

Find out what a file is:

ngr identify app.apk

Check in a script that a file is a known structure, without looking at the output:

ngr identify download.bin > /dev/null && echo "I know it"

See why another command rejects a file:

ngr identify app.xapk

Exit codes

Code When
0 The file is one of the five structures
1 The file does not exist, cannot be read or is a folder
2 The options are wrong: <file> is missing, there is an extra input or the option does not exist
3 ngr read it and it is none of the five structures (structure: unknown)

Things to know

  • The 3 is not a failure. It is the answer to the question "is it something I know?". A file that does not exist gives 1.
  • A file that is not a zip also gives unknown and 3, not 1: the absence of a zip is part of the answer. A six-byte text file confirms it:
file: nothing.txt
structure: unknown (6 B)
verbs: none - this is none of the five structures nogar knows.
beware: some verbs accept it anyway: decode, align, align --check, rotate, lineage
  • identify accepts a single file and not a folder.
  • The verbs: list is the one identify recognizes for that structure, and it does not always match what another command accepts: ngr merge also accepts an .apks, which identify does not list for that structure.

See also