shwenzhang/AndResGuard · error · ParameterException
Unsupported command: . See --help for supported commands
Error message
Unsupported command: <cmd>. See --help for supported commands
What it means
The apksigner CLI only supports a fixed set of top-level commands: sign, verify, help/version and --help. When the first positional argument does not match any of them, main throws this ParameterException before any signing work starts.
Solutions
- Run `apksigner --help` to list supported commands
- Use exactly `sign` or `verify` as the first argument
- Fix the typo or restructure the invocation so the command comes first
Example fix
// before apksigner signt --ks release.jks --out app-signed.apk app.apk // after apksigner sign --ks release.jks --out app-signed.apk app.apk
Defensive patterns
Strategy: validation
Validate before calling
String[] COMMANDS = {"sign","verify","help","version"};
if (args.length == 0 || !Arrays.asList(COMMANDS).contains(args[0])) {
throw new IllegalArgumentException("First argument must be one of " + Arrays.toString(COMMANDS));
} Type guard
boolean isSupportedCommand(String a0) {
return a0 != null && (a0.equals("sign") || a0.equals("verify") || a0.equals("help") || a0.equals("version") || a0.equals("--help") || a0.equals("-h"));
} Try / catch
// main already catches ParameterException and prints usage; when scripting:
apksigner --help | grep -q "^<cmd>" || { echo "unsupported command"; exit 1; } Prevention
- Always start the command line with sign or verify
- Check --help before scripting new invocations
- Validate args[0] in wrapper scripts
When it happens
Trigger: Running the tool with an unrecognized first argument, e.g. `apksigner signtest ...` (misspelling 'sign'), or passing a file path or flag as the first argument instead of a command.
Common situations: Typo in the command name; copying an old or different tool's CLI syntax; scripts invoking the tool with a file argument first instead of 'sign' or 'verify'.
Related errors
- Unsupported option: . See --help for supported options.
- Unexpected parameter(s) after
- Unexpected parameter(s) after input APK (<params[1]>)
- Unexpected parameter(s) after APK (<params[1]>)
- At least one signer must be specified
AI-assisted analysis of shwenzhang/AndResGuard@e4df245d82 (2026-09-12).
Data as JSON: /api/errors/90c5a34bf765d5f9.
Report an issue: GitHub.
Appendix: source
Thrown at AndResGuard-core/src/main/java/apksigner/ApkSignerTool.java:99
return;
}
String cmd = params[0];
try {
if ("sign".equals(cmd)) {
sign(Arrays.copyOfRange(params, 1, params.length));
return;
} else if ("verify".equals(cmd)) {
verify(Arrays.copyOfRange(params, 1, params.length));
return;
} else if ("help".equals(cmd)) {
printUsage(HELP_PAGE_GENERAL);
return;
} else if ("version".equals(cmd)) {
System.out.println(VERSION);
return;
} else {
throw new ParameterException("Unsupported command: " + cmd + ". See --help for supported commands");
}
} catch (ParameterException | OptionsParser.OptionsException e) {
System.err.println(e.getMessage());
System.exit(1);
return;
}
}
private static void sign(String[] params) throws Exception {
if (params.length == 0) {
printUsage(HELP_PAGE_SIGN);
return;
}
File outputApk = null;
File inputApk = null;
boolean verbose = false;
boolean v1SigningEnabled = true;View on GitHub (pinned to e4df245d82)