shwenzhang/AndResGuard · error · java.io.IOException

Can not found any signed apk file

Error message

Can not found any signed apk file

What it means

alignApks runs after signing and zipaligns the signed APK (and the 7z-repacked variant). If neither mSignedApk nor mSignedWith7ZipApk exists on disk, signing must have failed to produce any output, so this IOException is thrown. It indicates the signing step upstream silently failed.

Solutions

  1. Fix the underlying signing failure — inspect earlier log output from jarsigner/apksigner for the real cause
  2. Verify all v1sign/v2sign config values (keystore path, storePass, keyAlias, keyPass)
  3. Check that the output directory is writable and has enough disk space
  4. Ensure signing is actually required; if you did not intend to sign, set mUseSignAPK=false so alignApks is skipped
Defensive patterns

Strategy: try-catch

Validate before calling

// before running the build, ensure signing inputs are valid so signing can produce output
if (useSignApk) {
  if (!new File(keystorePath).isFile()) throw new IllegalStateException("keystore missing");
  if (storeAlias == null || storePass == null) throw new IllegalStateException("v1sign/v2sign config incomplete");
}

Try / catch

try {
  andResGuard.build();
} catch (IOException e) {
  if (e.getMessage().equals("Can not found any signed apk file")) {
    throw new IllegalStateException("no APK was produced by signing — inspect jarsigner/apksigner errors earlier in the log", e);
  }
  throw e;
}

Prevention

When it happens

Trigger: buildApkWithV1sign -> alignApks with config.mUseSignAPK=true when signApkV1 (and/or the 7z repackage) did not produce any signed APK file — typically because jarsigner or apksigner failed earlier and the failure was only logged.

Common situations: Build continues after a signing warning on CI; keystore credentials wrong so no signed jar was written; 7z repackage disabled and the plain signed APK missing; output directory not writable so signed APK creation failed.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at AndResGuard-core/src/main/java/com/tencent/mm/androlib/ResourceApkBuilder.java:274

        "-storepass",
        config.mStorePass,
        "-keypass",
        config.mKeyPass,
        "-signedjar",
        signedApk.getAbsolutePath(),
        unSignedApk.getAbsolutePath(),
        config.mStoreAlias
    };
    Utils.runExec(argv);
  }

  private void alignApks() throws IOException, InterruptedException {
    //如果不签名就肯定不需要对齐了
    if (!config.mUseSignAPK) {
      return;
    }
    if (!mSignedApk.exists() && !mSignedWith7ZipApk.exists()) {
      throw new IOException("Can not found any signed apk file");
    }
    if (mSignedApk.exists()) {
      alignApk(mSignedApk, mAlignedApk);
    }
    if (mSignedWith7ZipApk.exists()) {
      alignApk(mSignedWith7ZipApk, mAlignedWith7ZipApk);
    }
  }

  private void alignApk(File before, File after) throws IOException, InterruptedException {
    System.out.printf("zipaligning apk: %s, exists:%b\n", before.getAbsolutePath(), before.exists());
    if (!before.exists()) {
      throw new IOException(String.format("can not found the raw apk file to zipalign, path=%s",
          before.getAbsolutePath()
      ));
    }
    String cmd = Utils.isPresent(config.mZipalignPath) ? config.mZipalignPath : TypedValue.COMMAND_ZIPALIGIN;
    Utils.runCmd(cmd, "4", before.getAbsolutePath(), after.getAbsolutePath());

View on GitHub (pinned to e4df245d82)