{"record":{"id":"816871d7a7f0c9e4","repo":"Tencent/matrix","slug":"apk-unzip-path-inputpath-is-not-directory-816871","errorCode":null,"errorMessage":"---APK-UNZIP-PATH '<inputPath>' is not directory!","messagePattern":"---APK-UNZIP-PATH '<inputPath>' is not directory!","errorType":"exception","errorClass":"TaskInitException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/DuplicateFileTask.java","lineNumber":73,"sourceCode":"    private Map<String, String> entryNameMap;\n\n    public DuplicateFileTask(JobConfig config, Map<String, String> params) {\n        super(config, params);\n        type = TaskFactory.TASK_TYPE_DUPLICATE_FILE;\n    }\n\n    @Override\n    public void init() throws TaskInitException {\n        super.init();\n        String inputPath = config.getUnzipPath();\n        if (Util.isNullOrNil(inputPath)) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH can not be null!\");\n        }\n        inputFile = new File(inputPath);\n        if (!inputFile.exists()) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH '\" + inputPath + \"'is not exists!\");\n        } else if (!inputFile.isDirectory()) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH '\" + inputPath + \"' is not directory!\");\n        }\n        md5Map = new HashMap<>();\n        fileSizeList = new ArrayList<>();\n        entrySizeMap = config.getEntrySizeMap();\n        entryNameMap = config.getEntryNameMap();\n    }\n\n    private void computeMD5(File file) throws NoSuchAlgorithmException, IOException {\n        if (file != null) {\n            if (file.isDirectory()) {\n                File[] files = file.listFiles();\n                for (File resFile : files) {\n                    computeMD5(resFile);\n                }\n            } else {\n                MessageDigest msgDigest = MessageDigest.getInstance(\"MD5\");\n                BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(file));\n                byte[] buffer = new byte[512];","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/DuplicateFileTask.java#L55-L91","documentation":"DuplicateFileTask.init() throws TaskInitException when the unzip path exists but is a file, not a directory. The task expects the root of an unzipped APK (directories like res/, assets/) to walk for duplicate files.","triggerScenarios":"config.getUnzipPath() points to an existing regular file (e.g. the .apk itself, or a single extracted file) instead of the unzipped APK directory.","commonSituations":"Passing the APK file path where the unzipped directory is expected; confusing --apk input with --unzip output in ApkChecker CLI; a changed unzip layout after a tool version update.","solutions":["Pass the unzipped APK directory (containing AndroidManifest.xml, res/, etc.), not the .apk file.","Check with `file <path>` / `ls -la <path>` and point --unzip at the directory created by the unzip step.","Re-run the unzip step to regenerate the directory if it was replaced."],"exampleFix":"// before\nconfig.setUnzipPath(\"/build/app-release.apk\"); // it's a file\n// after\nconfig.setUnzipPath(\"/build/unzipped-apk/\"); // directory produced by UnzipTask","handlingStrategy":"validation","validationCode":"File dir = new File(config.getUnzipPath());\nif (dir.exists() && !dir.isDirectory()) {\n    throw new IllegalStateException(\"unzip path must be a directory, got file: \" + dir);\n}","typeGuard":null,"tryCatchPattern":"try {\n    task.init();\n} catch (TaskInitException e) {\n    if (e.getMessage().contains(\"is not directory\")) {\n        // reconfigure to point at the extracted directory instead of the apk file\n        config.setUnzipPath(extractedDir.getAbsolutePath());\n    }\n}","preventionTips":["Never pass the .apk file path to --unzip; it belongs to --apk.","Check `test -d <path>` before configuring the task.","Keep a single well-known extraction directory in your build pipeline."],"tags":["android","apk-checker","filesystem","init"],"backgroundTag":"path-is-not-a-directory","analyzedSha":"3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7","analyzedAt":"2026-09-08T08:01:39.722Z","contentChangedAt":"2026-09-08T08:01:39.722Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}