{"record":{"id":"8bf3183e0ba6479d","repo":"Tencent/matrix","slug":"apk-unzip-path-can-not-be-null-8bf318","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/UnzipTask.java","lineNumber":91,"sourceCode":"        resguardMap = new HashMap<>();\n        resDirMap = new HashMap<>();\n        entryNameMap = new HashMap<>();\n        entrySizeMap = new HashMap<>();\n    }\n\n    @Override\n    public void init() throws TaskInitException {\n        super.init();\n        if (Util.isNullOrNil(config.getApkPath())) {\n            throw new TaskInitException(TAG + \"---APK-FILE-PATH can not be null!\");\n        }\n        Log.i(TAG, \"inputPath:%s\", config.getApkPath());\n        inputFile = new File(config.getApkPath());\n        if (!inputFile.exists()) {\n            throw new TaskInitException(TAG + \"---'\" + config.getApkPath() + \"' is not exist!\");\n        }\n        if (Util.isNullOrNil(config.getUnzipPath())) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH can not be null!\");\n        }\n        Log.i(TAG, \"outputPath:%s\", config.getUnzipPath());\n        outputFile = new File(config.getUnzipPath());\n\n        if (!Util.isNullOrNil(config.getMappingFilePath())) {\n            mappingTxt = new File(config.getMappingFilePath());\n            if (!FileUtil.isLegalFile(mappingTxt)) {\n                throw new TaskInitException(TAG + \"---mapping file \" + config.getMappingFilePath() + \" is not legal!\");\n            }\n        }\n\n        if (!Util.isNullOrNil(config.getResMappingFilePath())) {\n            resMappingTxt = new File(config.getResMappingFilePath());\n            if (!FileUtil.isLegalFile(resMappingTxt)) {\n                throw new TaskInitException(TAG + \"---resguard mapping file \" + config.getResMappingFilePath() + \" is not legal!\");\n            }\n        }\n    }","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnzipTask.java#L73-L109","documentation":"UnzipTask.init() requires an output directory for the unzipped APK contents. When config.getUnzipPath() is null or empty it throws TaskInitException. Without an unzip output path the task cannot extract the APK entries.","triggerScenarios":"Running the ApkCanary pipeline with an ApkCheckConfiguration that has apkPath set but unzipPath left null/empty.","commonSituations":"Partially filled configuration object; plugin extension where only the APK path was set; copy-pasted config where the unzip/output dir line was removed.","solutions":["Set an output directory: config.setUnzipPath(\"build/matrix/unzip\").","Choose a directory that is either nonexistent (created in call()) or an existing directory that can be deleted/recreated.","If using the matrix gradle plugin, configure the output directory in the extension before the check task runs."],"exampleFix":"// before\nconfig.setApkPath(\"app.apk\");\n// after\nconfig.setApkPath(\"app.apk\");\nconfig.setUnzipPath(\"build/matrix/apk-unzip\");","handlingStrategy":"validation","validationCode":"if (config.getUnzipPath() == null || config.getUnzipPath().isEmpty()) {\n    throw new IllegalArgumentException(\"unzipPath must be set before running ApkCanary\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    task.init();\n} catch (TaskInitException e) {\n    logger.error(\"Check unzipPath configuration: \" + e.getMessage());\n    throw e;\n}","preventionTips":["Default unzipPath to a directory under build/ in a single configuration factory.","Validate all required config fields (apkPath, unzipPath) together before task execution."],"tags":["apk-canary","configuration","missing-path"],"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"}