shwenzhang/AndResGuard · error · java.io.IOException
can not found the aligned apk file, the ZipAlign path is…
Error message
can not found the aligned apk file, the ZipAlign path is correct? path=%s
What it means
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.
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at AndResGuard-core/src/main/java/com/tencent/mm/androlib/ResourceApkBuilder.java:294 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/e79e7082a5e2b6c7.
Report an issue: GitHub.
Appendix: source
Thrown at AndResGuard-core/src/main/java/com/tencent/mm/androlib/ResourceApkBuilder.java:294
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());
if (!after.exists()) {
throw new IOException(String.format("can not found the aligned apk file, the ZipAlign path is correct? path=%s",
mAlignedApk.getAbsolutePath()
));
}
}
private void generalUnsignApk(HashMap<String, Integer> compressData) throws IOException, InterruptedException {
System.out.printf("General unsigned apk: %s\n", mUnSignedApk.getName());
File tempOutDir = new File(mOutDir.getAbsolutePath(), TypedValue.UNZIP_FILE_PATH);
if (!tempOutDir.exists()) {
System.err.printf("Missing apk unzip files, path=%s\n", tempOutDir.getAbsolutePath());
System.exit(-1);
}
File[] unzipFiles = tempOutDir.listFiles();
assert unzipFiles != null;
List<File> collectFiles = new ArrayList<>();
for (File f : unzipFiles) {
String name = f.getName();View on GitHub (pinned to e4df245d82)