{"record":{"id":"1b81b68b85e4f0e5","repo":"shwenzhang/AndResGuard","slug":"repackagewith7z-7z-repackage-signed-apk-fail-you-must","errorCode":null,"errorMessage":"[repackageWith7z]7z repackage signed apk fail,you must install 7z command line version first, linux: p7zip, window: 7za, path=%s","messagePattern":"\\[repackageWith7z\\]7z repackage signed apk fail,you must install 7z command line version first, linux: p7zip, window: 7za, path=(.+?)","errorType":"exception","errorClass":"java.io.IOException","httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/com/tencent/mm/androlib/ResourceRepackage.java","lineNumber":105,"sourceCode":"    );\n    //首先一次性生成一个全部都是压缩的安装包\n    generalRaw7zip();\n    ArrayList<String> storedFiles = new ArrayList<>();\n    //对于不压缩的要update回去\n    for (String name : compressData.keySet()) {\n      File file = new File(m7zipOutPutDir.getAbsolutePath(), name);\n      if (!file.exists()) {\n        continue;\n      }\n      int method = compressData.get(name);\n      if (method == TypedValue.ZIP_STORED) {\n        storedFiles.add(name);\n      }\n    }\n\n    addStoredFileIn7Zip(storedFiles);\n    if (!mSignedWith7ZipApk.exists()) {\n      throw new IOException(String.format(\n          \"[repackageWith7z]7z repackage signed apk fail,you must install 7z command line version first, linux: p7zip, window: 7za, path=%s\",\n          mSignedWith7ZipApk.getAbsolutePath()\n      ));\n    }\n  }\n\n  private void generalRaw7zip() throws IOException, InterruptedException {\n    System.out.printf(\"general the raw 7zip file\\n\");\n    String outPath = m7zipOutPutDir.getAbsoluteFile().getAbsolutePath();\n    String path = outPath + File.separator + \"*\";\n\n    String cmd = Utils.isPresent(sevenZipPath) ? sevenZipPath : TypedValue.COMMAND_7ZIP;\n    ProcessBuilder pb = new ProcessBuilder(cmd, \"a\", \"-tzip\", mSignedWith7ZipApk.getAbsolutePath(), path, \"-mx9\");\n    Process pro = pb.start();\n\n    InputStreamReader ir = new InputStreamReader(pro.getInputStream());\n    LineNumberReader input = new LineNumberReader(ir);\n    //如果不读会有问题，被阻塞","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/com/tencent/mm/androlib/ResourceRepackage.java#L87-L123","documentation":"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.","triggerScenarios":"Thrown at AndResGuard-core/src/main/java/com/tencent/mm/androlib/ResourceRepackage.java:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"fallback","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"}