{"record":{"id":"a45cf5818bdf3923","repo":"Tencent/matrix","slug":"tag-apk-unzip-path-can-not-be-null-a45cf5","errorCode":null,"errorMessage":"TAG + \"---APK-UNZIP-PATH can not be null!\"","messagePattern":"TAG \\+ \"---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/UnusedAssetsTask.java","lineNumber":78,"sourceCode":"    private final Set<String> assetsPathSet;\n    private final Set<String> assetRefSet;\n\n    public UnusedAssetsTask(JobConfig config, Map<String, String> params) {\n        super(config, params);\n        type = TaskFactory.TASK_TYPE_UNUSED_ASSETS;\n        dexFileNameList = new ArrayList<>();\n        ignoreSet = new HashSet<>();\n        assetsPathSet = new HashSet<>();\n        assetRefSet = new HashSet<>();\n    }\n\n    @Override\n    public void init() throws TaskInitException {\n        super.init();\n\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 exist!\");\n        } else if (!inputFile.isDirectory()) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH '\" + inputPath + \"' is not directory!\");\n        }\n        if (params.containsKey(JobConstants.PARAM_IGNORE_ASSETS_LIST) && !Util.isNullOrNil(params.get(JobConstants.PARAM_IGNORE_ASSETS_LIST))) {\n            String[] ignoreAssets = params.get(JobConstants.PARAM_IGNORE_ASSETS_LIST).split(\",\");\n            Log.i(TAG, \"ignore assets %d\", ignoreAssets.length);\n            for (String ignore : ignoreAssets) {\n                ignoreSet.add(Util.globToRegexp(ignore));\n            }\n        }\n\n        File[] files = inputFile.listFiles();\n        if (files != null) {\n            for (File file : files) {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnusedAssetsTask.java#L60-L96","documentation":"UnusedAssetsTask.init() throws TaskInitException when the unzipped APK directory (config.getUnzipPath(), APK-UNZIP-PATH) is null or empty. The task walks the assets/ directory of the unzipped APK to detect unused assets.","triggerScenarios":"Running the unused-assets check without an unzip step, or with the unzip-path config key missing/null in MatrixConfig.","commonSituations":"Running only this task manually without preparing inputs; a CI refactor stopped passing the unzip directory between pipeline stages; typo in config key.","solutions":["Set the unzip path in MatrixConfig (or CLI flag) to the unzipped APK root.","Make sure the unzip task runs before UnusedAssetsTask in the pipeline.","Confirm the directory contains an assets/ subdirectory to scan."],"exampleFix":"// before\nMatrixConfig cfg = new MatrixConfig.Builder().build();\n// after\nMatrixConfig cfg = new MatrixConfig.Builder().setApkPath(apk).setApkUnzipPath(unzipDir).build();","handlingStrategy":"validation","validationCode":"String unzipPath = config.getApkUnzipPath();\nif (unzipPath == null || unzipPath.isEmpty() || !new File(unzipPath).isDirectory()) {\n    throw new IllegalStateException(\"APK-UNZIP-PATH must point to an existing unzipped-APK directory\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    job.run();\n} catch (TaskInitException e) {\n    if (e.getMessage().contains(\"APK-UNZIP-PATH can not be null\")) {\n        runUnzipTaskThenRetry();\n    } else throw e;\n}","preventionTips":["Run the unzip task before unused-assets analysis in the pipeline.","Validate unzip-path config at job construction time.","Keep the unzip directory inside the same workspace/lifecycle.","Use absolute paths in CI configuration."],"tags":["android","apk-canary","config","unzip-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"}