{"record":{"id":"5d9603bc75fa692a","repo":"Tencent/matrix","slug":"apk-unzip-path-can-not-be-null-5d9603","errorCode":null,"errorMessage":"---APK-UNZIP-PATH can not be null!","messagePattern":"---APK-UNZIP-PATH can not be null!","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":67,"sourceCode":"    private static final String TAG = \"Matrix.DuplicateFileTask\";\n\n    private File inputFile;\n    private Map<String, List<String>> md5Map;\n    private List<Pair<String, Long>> fileSizeList;\n    private Map<String, Pair<Long, Long>> entrySizeMap;\n    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) {","sourceCodeStart":49,"sourceCodeEnd":85,"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#L49-L85","documentation":"Matrix APK Checker's DuplicateFileTask throws TaskInitException during init() when config.getUnzipPath() is null or empty. Every check task requires an unzipped APK directory to scan for duplicate resources (same MD5). init() runs before the task executes, so missing configuration fails fast.","triggerScenarios":"Running DuplicateFileTask (as part of ApkCheckTask/task list via ApkChecker) with a JobConfig whose PARAM_UNZIP_PATH is not set, or set to null/empty string.","commonSituations":"Forgetting the '--unzip <path>' CLI argument when invoking ApkChecker; programmatically building TaskConfig without calling setUnzipPath; a prior unzip step failing silently so the path was never populated.","solutions":["Pass the unzip path: add '--unzip <dir-of-unzipped-apk>' to the ApkChecker invocation or set config.setUnzipPath(path) before running.","Ensure the unzip step runs before DuplicateFileTask (e.g. UnzipTask output feeds this config).","Log/verify config.getUnzipPath() right before task initialization to confirm it is populated."],"exampleFix":"// before\nApkChecker.run(new JobConfig(...)); // no unzip path set\n// after\nJobConfig config = new JobConfig();\nconfig.setUnzipPath(\"/build/apk-unzipped/\"); // must be non-null, non-empty\nApkChecker.run(config);","handlingStrategy":"validation","validationCode":"String unzipPath = config.getUnzipPath();\nif (unzipPath == null || unzipPath.trim().isEmpty()) {\n    throw new IllegalStateException(\"unzip path must be set before running DuplicateFileTask\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    task.init();\n} catch (TaskInitException e) {\n    if (e.getMessage().contains(\"APK-UNZIP-PATH can not be null\")) {\n        config.setUnzipPath(defaultUnzipDir);\n    }\n}","preventionTips":["Always call setUnzipPath() (or pass --unzip) before enabling any check task.","Run UnzipTask first in the task pipeline and feed its output path into config.","Add a CI assertion that the unzip path is non-empty before invoking ApkChecker."],"tags":["android","apk-checker","config","init"],"backgroundTag":"missing-required-config-field","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"}