shwenzhang/AndResGuard · error · ParameterException

Missing input APK

Error message

Missing input APK

What it means

Validation guard in ApkSignerTool.sign: neither --in/--input was given nor a positional APK path remains, so the tool has no APK to sign. Fires when apksigner is invoked with signer options but the input APK argument is missing entirely, e.g. 'apksigner sign --ks keystore.jks' with no APK.

Solutions

  1. Pass the APK path positionally: `apksigner sign --ks ks.jks app.apk`
  2. Or add --in app.apk
  3. In scripts, guard: `[ -f "$APK" ] || exit 1` before invoking

Example fix

// before
apksigner sign --ks ks.jks --out app-signed.apk
// after
apksigner sign --ks ks.jks --out app-signed.apk app.apk
Defensive patterns

Strategy: validation

Validate before calling

if (!Arrays.asList(args).contains("--in") && positionalArgs(args).length == 0) throw new IllegalArgumentException("Input APK path required");

Try / catch

try { signCmd(args); } catch (ParameterException e) { System.err.println("Missing input APK: " + e.getMessage()); exit(1); }

Prevention

When it happens

Trigger: `apksigner sign --ks ks.jks --out out.apk` with neither --in nor a positional APK path; or a variable holding the APK path expanding to empty in a script.

Common situations: Shell scripts where $APK is unset/empty; forgetting the input file entirely; reordering arguments so the path was consumed as an option value.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of shwenzhang/AndResGuard@e4df245d82 (2026-09-12). Data as JSON: /api/errors/1ae49c65e02483be. Report an issue: GitHub.

Appendix: source

Thrown at AndResGuard-core/src/main/java/apksigner/ApkSignerTool.java:204

    }
    signerParams = null;

    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) {

View on GitHub (pinned to e4df245d82)