shwenzhang/AndResGuard · error · ParameterException

Missing APK

Error message

Missing APK

What it means

The verify command could not find an input APK: neither --in was given nor was any positional argument left after option parsing, so there is no APK to verify. The tool throws rather than guessing a default file.

Solutions

  1. Pass the APK: `apksigner verify --in path/to/app.apk` or `apksigner verify path/to/app.apk`.
  2. Check that the variable holding the APK path is set and non-empty before invoking.
  3. Verify the file path is correct; note this error is about the missing argument, not file existence.

Example fix

// before (shell)
apksigner verify $APK   # APK is unset
// after
[ -n "$APK" ] && apksigner verify --in "$APK"
Defensive patterns

Strategy: validation

Validate before calling

// shell: fail fast when APK path is unset/empty
APK=${APK:?"APK path is empty"}
[ -f "$APK" ] || { echo "APK not found: $APK" >&2; exit 1; }
apksigner verify --in "$APK"

Prevention

When it happens

Trigger: Running `apksigner verify` with no APK argument and no --in option, e.g. invoking the command from a script where a variable holding the APK path expanded to empty (`apksigner verify $APK` with APK unset).

Common situations: CI scripts where an env var or build output path is empty; forgetting the APK argument entirely; accidentally quoting away the argument so the shell drops it.

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/d5d5c217b0761502. Report an issue: GitHub.

Appendix: source

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

        throw new ParameterException("Unsupported option: "
                                     + optionOriginalForm
                                     + ". 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();

View on GitHub (pinned to e4df245d82)