shwenzhang/AndResGuard · error · java.io.IOException

can not found the signed apk file to repackage, path=

Error message

can not found the signed apk file to repackage, path=%s

What it means

Validation guard in ResourceRepackage.insureFileName (part of repackageApk): the signed APK that the 7z repackage step operates on (mSignedApk, e.g. output.apk in the out dir) does not exist. The 7-Zip repackaging pipeline rewrites the already-signed APK, so without it there is nothing to repackage — typically the sign step was skipped, failed, or wrote elsewhere.

Solutions

  1. Ensure the signing step ran and produced the signed apk at the expected path before repackaging with 7z
  2. Check that the output directory configuration points to where the signed apk was actually written; stale or wrong mOutDir settings commonly cause this
  3. Regenerate the signed apk by re-running the build/sign phase
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at AndResGuard-core/src/main/java/com/tencent/mm/androlib/ResourceRepackage.java:59 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at AndResGuard-core/src/main/java/com/tencent/mm/androlib/ResourceRepackage.java:59

  }

  private void deleteUnusedFiles() {
    //删除目录
    FileOperation.deleteDir(m7zipOutPutDir);
    FileOperation.deleteDir(mStoredOutPutDir);
    if (mSignedWith7ZipApk.exists()) {
      mSignedWith7ZipApk.delete();
    }
  }

  /**
   * 这边有点不太一样,就是当输出目录存在的时候是不会强制删除目录的
   *
   * @throws IOException
   */
  private void insureFileName() throws IOException {
    if (!mSignedApk.exists()) {
      throw new IOException(String.format("can not found the signed apk file to repackage" + ", path=%s",
          mSignedApk.getAbsolutePath()
      ));
    }
    //需要自己安装7zip
    String apkBasename = mSignedApk.getName();
    mApkName = apkBasename.substring(0, apkBasename.indexOf(".apk"));
    //如果外面设过,就不用设了
    if (mOutDir == null) {
      mOutDir = new File(mSignedApk.getAbsoluteFile().getParent(), mApkName);
    }

    mSignedWith7ZipApk = new File(mOutDir.getAbsolutePath(), mApkName + "_channel_7zip.apk");
    mAlignedWith7ZipApk = new File(mOutDir.getAbsolutePath(), mApkName + "_channel_7zip_aligned.apk");

    m7zipOutPutDir = new File(mOutDir.getAbsolutePath(), TypedValue.OUT_7ZIP_FILE_PATH);
    mStoredOutPutDir = new File(mOutDir.getAbsolutePath(), "storefiles");
    //删除目录,因为之前的方法是把整个输出目录都删除,所以不会有问题,现在不会,所以要单独删
    FileOperation.deleteDir(m7zipOutPutDir);

View on GitHub (pinned to e4df245d82)