shwenzhang/AndResGuard · error · ParameterException
Unexpected parameter(s) after APK (<params[1]>)
Error message
Unexpected parameter(s) after APK (<params[1]>)
What it means
When the input APK is given positionally (no --in), verify accepts exactly one positional argument. More than one leftover parameter is ambiguous, so the tool rejects the command naming the first extra parameter.
Solutions
- Verify one APK per invocation; loop over files in a script instead.
- Remove the extra positional argument, keeping only the APK path.
- If an option was intended, check spelling against `apksigner verify --help` — unsupported options must go before the APK and be recognized flags.
Example fix
// before apksigner verify app.apk other.apk // after apksigner verify app.apk && apksigner verify other.apk
Defensive patterns
Strategy: validation
Validate before calling
// shell: verify one APK per invocation for apk in "$@"; do apksigner verify --in "$apk" || exit 1 done
Prevention
- Never pass multiple APKs to a single verify command
- Put all flags before the APK argument and check flag spelling
- Add shellcheck to scripts to catch unquoted/extra arguments
When it happens
Trigger: Running `apksigner verify app.apk other.apk` or `apksigner verify app.apk --some-misplaced-flag` where a flag-like token isn't recognized as an option and lands in remaining params, making params.length > 1 at line 351.
Common situations: Trying to verify multiple APKs in one command (unsupported); passing extra arguments intended for a different subcommand; a typo or unquoted option that the OptionsParser treats as positional.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- Unsupported command: . See --help for supported commands
- Unsupported option: . See --help for supported options.
- Unexpected parameter(s) after
- Unexpected parameter(s) after input APK (<params[1]>)
- Missing APK
AI-assisted analysis of shwenzhang/AndResGuard@e4df245d82 (2026-09-12).
Data as JSON: /api/errors/6a4a3b5b3e41945e.
Report an issue: GitHub.
Appendix: source
Thrown at AndResGuard-core/src/main/java/apksigner/ApkSignerTool.java:352
+ ". See --help for supported"
+ " options.");
}
}
params = optionsParser.getRemainingParams();
if (inputApk != null) {
// Input APK has been specified in preceding parameters. We don't expect any more
// parameters.
if (params.length > 0) {
throw new ParameterException("Unexpected parameter(s) after " + optionOriginalForm + ": " + params[0]);
}
} else {
// Input APK has not been specified in preceding parameters. The next parameter is
// supposed to be the input APK.
if (params.length < 1) {
throw new ParameterException("Missing APK");
} else if (params.length > 1) {
throw new ParameterException("Unexpected parameter(s) after APK (" + params[1] + ")");
}
inputApk = new File(params[0]);
}
if ((minSdkVersionSpecified) && (maxSdkVersionSpecified) && (minSdkVersion > maxSdkVersion)) {
throw new ParameterException("Min API Level (" + minSdkVersion + ") > max API Level (" + maxSdkVersion + ")");
}
ApkVerifier.Builder apkVerifierBuilder = new ApkVerifier.Builder(inputApk);
if (minSdkVersionSpecified) {
apkVerifierBuilder.setMinCheckedPlatformVersion(minSdkVersion);
}
if (maxSdkVersionSpecified) {
apkVerifierBuilder.setMaxCheckedPlatformVersion(maxSdkVersion);
}
ApkVerifier apkVerifier = apkVerifierBuilder.build();
ApkVerifier.Result result;
try {View on GitHub (pinned to e4df245d82)