shwenzhang/AndResGuard · error · ParameterException
Unexpected parameter(s) after input APK (<params[1]>)
Error message
Unexpected parameter(s) after input APK (<params[1]>)
What it means
Validation in ApkSignerTool.sign: after --in/--input supplied the APK path, additional positional parameters remain on the command line. The tool treats everything after the input APK as unexpected; this fires when the user passes extra arguments (duplicate APK paths, mistyped flags without '--', etc.) alongside --in.
Solutions
- Keep only the input APK positional and move everything else to options (--out, etc.)
- Quote paths containing spaces
- Remove duplicated positional arguments
Example fix
// before apksigner sign --ks ks.jks app.apk app-signed.apk // after apksigner sign --ks ks.jks --out app-signed.apk app.apk
Defensive patterns
Strategy: validation
Validate before calling
if (!usesInFlag(args) && positionalArgs(args).length > 1) throw new IllegalArgumentException("Only one positional arg (input APK) allowed; use --out for output"); Try / catch
try { signCmd(args); } catch (ParameterException e) { System.err.println(e.getMessage()); exit(1); } Prevention
- Pass output via --out, never positionally
- Quote paths containing spaces
- Keep only the input APK as a positional argument
When it happens
Trigger: `apksigner sign --ks ks.jks app.apk other-file` — an extra positional argument such as the output path mistakenly placed positionally, or unquoted paths with spaces splitting into multiple args.
Common situations: Assuming output can be positional (it requires --out); unquoted file paths containing spaces; passing both input and output positionally.
Related errors
- Unsupported command: . See --help for supported commands
- Unsupported option: . See --help for supported options.
- Unexpected parameter(s) after
- 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/358603bd16744771.
Report an issue: GitHub.
Appendix: source
Thrown at AndResGuard-core/src/main/java/apksigner/ApkSignerTool.java:206
if (signers.isEmpty()) {
throw new ParameterException("At least one signer must be specified");
}
params = optionsParser.getRemainingParams();
if (inputApk != null) {
// Input APK has been specified via 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 via preceding parameters. The next parameter is
// supposed to be the path to input APK.
if (params.length < 1) {
throw new ParameterException("Missing input APK");
} else if (params.length > 1) {
throw new ParameterException("Unexpected parameter(s) after input APK (" + params[1] + ")");
}
inputApk = new File(params[0]);
}
if ((minSdkVersionSpecified) && (minSdkVersion > maxSdkVersion)) {
throw new ParameterException("Min API Level (" + minSdkVersion + ") > max API Level (" + maxSdkVersion + ")");
}
List<ApkSigner.SignerConfig> signerConfigs = new ArrayList<>(signers.size());
int signerNumber = 0;
try (PasswordRetriever passwordRetriever = new PasswordRetriever()) {
for (SignerParams signer : signers) {
signerNumber++;
signer.name = "signer #" + signerNumber;
try {
signer.loadPrivateKeyAndCerts(passwordRetriever);
} catch (ParameterException e) {
System.err.println("Failed to load signer \"" + signer.name + "\": " + e.getMessage());
System.exit(2);View on GitHub (pinned to e4df245d82)