{"record":{"id":"e79e7082a5e2b6c7","repo":"shwenzhang/AndResGuard","slug":"can-not-found-the-aligned-apk-file-the-zipalign-path-is","errorCode":null,"errorMessage":"can not found the aligned apk file, the ZipAlign path is correct? path=%s","messagePattern":"can not found the aligned apk file, the ZipAlign path is correct\\? path=(.+?)","errorType":"exception","errorClass":"java.io.IOException","httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/com/tencent/mm/androlib/ResourceApkBuilder.java","lineNumber":294,"sourceCode":"    if (mSignedApk.exists()) {\n      alignApk(mSignedApk, mAlignedApk);\n    }\n    if (mSignedWith7ZipApk.exists()) {\n      alignApk(mSignedWith7ZipApk, mAlignedWith7ZipApk);\n    }\n  }\n\n  private void alignApk(File before, File after) throws IOException, InterruptedException {\n    System.out.printf(\"zipaligning apk: %s, exists:%b\\n\", before.getAbsolutePath(), before.exists());\n    if (!before.exists()) {\n      throw new IOException(String.format(\"can not found the raw apk file to zipalign, path=%s\",\n          before.getAbsolutePath()\n      ));\n    }\n    String cmd = Utils.isPresent(config.mZipalignPath) ? config.mZipalignPath : TypedValue.COMMAND_ZIPALIGIN;\n    Utils.runCmd(cmd, \"4\", before.getAbsolutePath(), after.getAbsolutePath());\n    if (!after.exists()) {\n      throw new IOException(String.format(\"can not found the aligned apk file, the ZipAlign path is correct? path=%s\",\n          mAlignedApk.getAbsolutePath()\n      ));\n    }\n  }\n\n  private void generalUnsignApk(HashMap<String, Integer> compressData) throws IOException, InterruptedException {\n    System.out.printf(\"General unsigned apk: %s\\n\", mUnSignedApk.getName());\n    File tempOutDir = new File(mOutDir.getAbsolutePath(), TypedValue.UNZIP_FILE_PATH);\n    if (!tempOutDir.exists()) {\n      System.err.printf(\"Missing apk unzip files, path=%s\\n\", tempOutDir.getAbsolutePath());\n      System.exit(-1);\n    }\n\n    File[] unzipFiles = tempOutDir.listFiles();\n    assert unzipFiles != null;\n    List<File> collectFiles = new ArrayList<>();\n    for (File f : unzipFiles) {\n      String name = f.getName();","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/com/tencent/mm/androlib/ResourceApkBuilder.java#L276-L312","documentation":"Thrown by ResourceApkBuilder.alignApk before running zipalign: the APK file that should have been produced by the earlier sign step (before.getName() — e.g. the signed or 7z-signed output) does not exist on disk. The message's mention of the ZipAlign path is slightly misleading; the real issue is that the upstream signing/output step failed or wrote to a different directory, leaving no aligned output to align.","triggerScenarios":"Thrown at AndResGuard-core/src/main/java/com/tencent/mm/androlib/ResourceApkBuilder.java:294 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the earlier signing/repackaging step actually produced the apk file that zipalign is about to process; if the signed apk was skipped or deleted, regenerate it","Verify the zipalign executable path in the config (mZipalignPath) is correct and the binary exists and is executable","Re-run the build pipeline from the signing step so the input apk exists before alignment"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e4df245d82f27d9a2d0dd108260a3510cbaba849","analyzedAt":"2026-09-12T17:49:07.798Z","contentChangedAt":"2026-09-12T17:49:07.798Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}