shwenzhang/AndResGuard · error · java.io.IOException
[repackageWith7z]7z repackage signed apk fail,you must…
Error message
[repackageWith7z]7z repackage signed apk fail,you must install 7z command line version first, linux: p7zip, window: 7za, path=%s
What it means
Thrown by ResourceRepackage.repackageWith7z after running the 7-Zip compression pipeline: the expected 7z-repackaged signed APK (mSignedWith7ZipApk) was not produced. This means the 7-Zip command failed — most commonly because the p7zip/7za command-line tool is not installed or not on PATH — so the compression ran but generated no output APK.
Solutions
- Install the 7-Zip command line tool: p7zip on Linux (apt-get install p7zip-full) or 7za on Windows, and ensure it is on PATH
- Verify the configured 7z executable path in the build config is correct and executable
- If 7z compression is not required, disable the 7zip repackage option so the pipeline uses the regular zip output
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at AndResGuard-core/src/main/java/com/tencent/mm/androlib/ResourceRepackage.java:105 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/1b81b68b85e4f0e5.
Report an issue: GitHub.
Appendix: source
Thrown at AndResGuard-core/src/main/java/com/tencent/mm/androlib/ResourceRepackage.java:105
);
//首先一次性生成一个全部都是压缩的安装包
generalRaw7zip();
ArrayList<String> storedFiles = new ArrayList<>();
//对于不压缩的要update回去
for (String name : compressData.keySet()) {
File file = new File(m7zipOutPutDir.getAbsolutePath(), name);
if (!file.exists()) {
continue;
}
int method = compressData.get(name);
if (method == TypedValue.ZIP_STORED) {
storedFiles.add(name);
}
}
addStoredFileIn7Zip(storedFiles);
if (!mSignedWith7ZipApk.exists()) {
throw new IOException(String.format(
"[repackageWith7z]7z repackage signed apk fail,you must install 7z command line version first, linux: p7zip, window: 7za, path=%s",
mSignedWith7ZipApk.getAbsolutePath()
));
}
}
private void generalRaw7zip() throws IOException, InterruptedException {
System.out.printf("general the raw 7zip file\n");
String outPath = m7zipOutPutDir.getAbsoluteFile().getAbsolutePath();
String path = outPath + File.separator + "*";
String cmd = Utils.isPresent(sevenZipPath) ? sevenZipPath : TypedValue.COMMAND_7ZIP;
ProcessBuilder pb = new ProcessBuilder(cmd, "a", "-tzip", mSignedWith7ZipApk.getAbsolutePath(), path, "-mx9");
Process pro = pb.start();
InputStreamReader ir = new InputStreamReader(pro.getInputStream());
LineNumberReader input = new LineNumberReader(ir);
//如果不读会有问题,被阻塞View on GitHub (pinned to e4df245d82)