Command-by-command equivalents
If you already use another tool, find your command in the right-hand column. The left-hand one is the ngr
command that does the same thing or the closest to it. Where the result is not the same,
“Behavior differences” says so.
In the commands of the Java tools the launcher is omitted: apktool is its script, and APKEditor, baksmali
and smali are java -jar <file>.jar.
Inspect
ngr |
Other tools |
|---|---|
ngr info app.apk |
aapt2 dump badging app.apk · APKEditor info -i app.apk · apkanalyzer apk summary app.apk |
ngr info --package app.apk |
aapt2 dump packagename app.apk · apkanalyzer manifest application-id app.apk |
ngr info --version-code --version-name app.apk |
apkanalyzer manifest version-code app.apk · apkanalyzer manifest version-name app.apk |
ngr info --min-sdk-version --target-sdk-version app.apk |
apkanalyzer manifest min-sdk app.apk · apkanalyzer manifest target-sdk app.apk |
ngr info --permissions app.apk |
aapt2 dump permissions app.apk · apkanalyzer manifest permissions app.apk |
ngr info --resources app.apk |
aapt2 dump resources app.apk · APKEditor info -i app.apk -resources |
ngr info --strings app.apk |
aapt2 dump strings app.apk · APKEditor info -i app.apk -strings |
ngr info --configurations app.apk |
aapt2 dump configurations app.apk |
ngr info --files app.apk |
apkanalyzer files list app.apk · APKEditor info -i app.apk -list-files |
ngr info --format json app.apk |
APKEditor info -i app.apk -t json |
ngr resource app.apk @string/app_name |
APKEditor info -i app.apk -res @string/app_name |
ngr xml app.apk AndroidManifest.xml |
aapt2 dump xmltree --file AndroidManifest.xml app.apk · APKEditor info -i app.apk -xmltree AndroidManifest.xml |
ngr xml --strings app.apk AndroidManifest.xml |
aapt2 dump xmlstrings --file AndroidManifest.xml app.apk · APKEditor info -i app.apk -xmlstrings AndroidManifest.xml |
ngr identify app.apk |
No direct equivalent |
apkanalyzer manifest print app.apk prints the manifest as text xml. In ngr, that is the AndroidManifest.xml
that ngr decode writes.
Decode and build
ngr |
Apktool | APKEditor |
|---|---|---|
ngr decode app.apk |
apktool d app.apk |
APKEditor d -i app.apk |
ngr decode -o dir app.apk |
apktool d -o dir app.apk |
APKEditor d -i app.apk -o dir |
ngr decode -f app.apk |
apktool d -f app.apk |
APKEditor d -i app.apk -f |
ngr decode --dex app.apk |
apktool d -s app.apk |
APKEditor d -i app.apk -dex |
ngr decode --type raw --dex app.apk |
APKEditor d -i app.apk -t raw |
|
ngr decode --no-debug-info app.apk |
apktool d --no-debug-info app.apk |
APKEditor d -i app.apk -no-dex-debug |
ngr build app |
apktool b app |
APKEditor b -i app |
ngr build -o out.apk app |
apktool b -o out.apk app |
APKEditor b -i app -o out.apk |
ngr build --no-cache app |
APKEditor b -i app -no-cache |
The default output names do not match. ngr decode app.apk writes app/ and ngr build app writes
app_built.apk, both next to the input. When building, Apktool writes the apk in a dist/ folder inside the
project. If you switch tools in a script, give the destination with -o.
Merge, restore and obfuscate
ngr |
APKEditor |
|---|---|
ngr merge app.xapk |
APKEditor m -i app.xapk |
ngr merge --clean-meta app.xapk |
APKEditor m -i app.xapk -clean-meta |
ngr merge --extract-native-libs false app.xapk |
APKEditor m -i app.xapk -extractNativeLibs false |
ngr merge --validate-modules app.xapk |
APKEditor m -i app.xapk -validate-modules |
ngr refactor app.apk |
APKEditor x -i app.apk |
ngr refactor --fix-types app.apk |
APKEditor x -i app.apk -fix-types |
ngr protect app.apk |
APKEditor p -i app.apk |
ngr protect --skip-manifest --keep-type font app.apk |
APKEditor p -i app.apk -skip-manifest -keep-type font |
ngr protect --confuse-zip app.apk |
APKEditor p -i app.apk -confuse-zip |
Align
ngr |
zipalign |
|---|---|
ngr align app.apk |
zipalign 4 app.apk app_aligned.apk |
ngr align -f -o out.apk app.apk |
zipalign -f 4 app.apk out.apk |
ngr align --page-size 16 app.apk |
zipalign -P 16 4 app.apk app_aligned.apk |
ngr align --alignment 8 app.apk |
zipalign 8 app.apk app_aligned.apk |
ngr align --check app.apk |
zipalign -c 4 app.apk |
ngr align --check -v app.apk |
zipalign -c -v 4 app.apk |
Sign and verify
ngr |
apksigner |
|---|---|
ngr sign --ks k.p12 --ks-pass env:P app.apk |
apksigner sign --ks k.p12 --ks-pass env:P --out app_signed.apk app.apk |
ngr sign --ks k.p12 --ks-key-alias a app.apk |
apksigner sign --ks k.p12 --ks-key-alias a --out app_signed.apk app.apk |
--no-v1, --no-v2, --no-v3 |
--v1-signing-enabled false, --v2-signing-enabled false, --v3-signing-enabled false |
--no-v4 |
--v4-signing-enabled false |
--v4 |
--v4-signing-enabled true |
--verity |
--verity-enabled |
--alignment-preserved |
--alignment-preserved |
--page-size 16 |
--lib-page-alignment 16384 |
--min-sdk-version 24 |
--min-sdk-version 24 |
--lineage lineage.bin |
--lineage lineage.bin |
--rotation-min-sdk-version 33 |
--rotation-min-sdk-version 33 |
a second --ks new.p12 |
--next-signer --ks new.p12 |
ngr sign --debug-key app.apk |
No equivalent. uber-apk-signer --apks app.apk signs with a debug key of its own |
ngr verify app.apk |
apksigner verify app.apk |
ngr verify -v --print-certs app.apk |
apksigner verify -v --print-certs app.apk |
ngr verify --min-sdk-version 24 --max-sdk-version 34 app.apk |
apksigner verify --min-sdk-version 24 --max-sdk-version 34 app.apk |
ngr verify --v4-signature-file app.apk.idsig app.apk |
apksigner verify --v4-signature-file app.apk.idsig app.apk |
Passwords are given the same way in both: pass:, env:, file: or stdin.
Rotate the key
ngr |
apksigner |
|---|---|
ngr rotate -o l.bin --old-ks a.p12 --new-ks b.p12 |
apksigner rotate --out l.bin --old-signer --ks a.p12 --new-signer --ks b.p12 |
ngr rotate -o l2.bin --old-ks b.p12 --new-ks c.p12 l.bin |
apksigner rotate --in l.bin --out l2.bin --old-signer --ks b.p12 --new-signer --ks c.p12 |
--old-set rollback |
--set-rollback true, after --old-signer |
--new-unset shared-uid |
--set-shared-uid false, after --new-signer |
ngr lineage --print-certs l.bin |
apksigner lineage --in l.bin --print-certs |
ngr lineage --ks a.p12 --unset auth -o l2.bin l.bin |
apksigner lineage --in l.bin --out l2.bin --signer --ks a.p12 --set-auth false |
The five capabilities are called installed-data, shared-uid, permission, rollback and auth in ngr, and
go with --set or --unset. In apksigner each one is an option: --set-installed-data, --set-shared-uid,
--set-permission, --set-rollback and --set-auth, with true or false.
Dex and smali
ngr |
smali and baksmali |
|---|---|
ngr disassemble classes.dex |
baksmali d classes.dex -o classes_smali |
ngr disassemble app.apk/classes2.dex |
baksmali d app.apk/classes2.dex |
-j 4 |
-j 4 |
--use-locals |
--use-locals |
--no-debug-info |
--debug-info false |
--no-accessor-comments |
--accessor-comments false |
--no-parameter-registers |
--parameter-registers false |
--code-offsets |
--code-offsets |
--implicit-references |
--implicit-references |
--sequential-labels |
--sequential-labels |
--classes 'La/b;,Lc/d;' |
--classes 'La/b;,Lc/d;' |
--resolve-resources R=public.xml |
--resolve-resources R public.xml |
ngr assemble classes_smali |
smali a classes_smali -o classes_smali.dex |
ngr assemble --android-api 26 classes_smali |
smali a -a 26 classes_smali -o classes_smali.dex |
ngr dump classes.dex |
baksmali dump classes.dex |
ngr list classes classes.dex |
baksmali list classes classes.dex |
ngr list strings, fields, methods, types, dex |
baksmali list strings, fields, methods, types, dex |
With apkanalyzer, apkanalyzer dex list app.apk lists the dex files and apkanalyzer dex packages app.apk the
tree of packages, classes and methods. Apktool and APKEditor disassemble and assemble as part of d and b.
Decompile
ngr |
jadx |
|---|---|
ngr decompile app.apk |
jadx --no-res -d app_java app.apk |
ngr decompile -o out app.apk |
jadx --no-res -d out app.apk |
-j 4 |
-j 4 |
--deobf |
--deobf |
--mappings mapping.txt |
--mappings-path <file>, with other formats |
--classes 'Lcom/example/Main;' |
--single-class com.example.Main |
--debug-info ignore |
--no-debug-info |
--unstructured smali |
The closest is --decompilation-mode, which applies to all the code |
--report report.json |
No equivalent. --output-format json writes the code as JSON, which is something else |
--java-version, --stubs, --line-numbers, --packages, --exclude-packages, --android-api, --android-jar |
No direct equivalent |
Without --no-res, jadx also decodes the resources of the apk. In ngr, that is ngr decode.
Complete recipes
Modify an apk and leave it installable:
# with ngr
ngr decode app.apk
ngr build app
ngr sign --ks k.p12 --ks-pass env:P app_built.apk
# with Apktool, zipalign and apksigner
apktool d -o app app.apk
apktool b -o app_built.apk app
zipalign -P 16 4 app_built.apk app_aligned.apk
apksigner sign --ks k.p12 --ks-pass env:P --out app_signed.apk app_aligned.apk
Install an .xapk as a single apk:
# with ngr
ngr merge app.xapk
ngr sign --ks k.p12 --ks-pass env:P app_merged.apk
# with APKEditor, zipalign and apksigner
java -jar APKEditor.jar m -i app.xapk -o app_merged.apk
zipalign -P 16 4 app_merged.apk app_aligned.apk
apksigner sign --ks k.p12 --ks-pass env:P --out app_signed.apk app_aligned.apk