{"record":{"id":"54e06686150e0d3d","repo":"Tencent/matrix","slug":"tag-apk-unzip-path-can-not-be-null-54e066","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/UnusedResourcesTask.java","lineNumber":105,"sourceCode":"        dexFileNameList = new ArrayList<>();\n        ignoreSet = new HashSet<>();\n        rclassProguardMap = new HashMap<>();\n        resguardMap = new HashMap<>();\n        resourceDefMap = new HashMap<>();\n        styleableMap = new HashMap<>();\n        resourceRefSet = new HashSet<>();\n        unusedResSet = new HashSet<>();\n        nonValueReferences = new HashMap<>();\n        visitPath = new Stack<String>();\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        if (!params.containsKey(JobConstants.PARAM_R_TXT) || Util.isNullOrNil(params.get(JobConstants.PARAM_R_TXT))) {\n            throw new TaskInitException(TAG + \"---The File 'R.txt' can not be null!\");\n        }\n        resourceTxt = new File(params.get(JobConstants.PARAM_R_TXT));\n        if (!FileUtil.isLegalFile(resourceTxt)) {\n            throw new TaskInitException(TAG + \"---The Resource declarations file 'R.txt' is not legal!\");\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 (!Util.isNullOrNil(config.getMappingFilePath())) {\n            mappingTxt = new File(config.getMappingFilePath());\n            if (!FileUtil.isLegalFile(mappingTxt)) {\n                throw new TaskInitException(TAG + \"---The Proguard mapping file 'mapping.txt' is not legal!\");","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnusedResourcesTask.java#L87-L123","documentation":"UnusedResourcesTask.init() throws TaskInitException when the configured APK unzip path is null or empty. The task needs the extracted APK directory to scan resources. This is a required-configuration check performed before the task runs.","triggerScenarios":"JobConstants.PARAM_UNZIP_PATH / config.getUnzipPath() not set when adding UnusedResourcesTask to an ApkChecker job.","commonSituations":"Forgetting to pass -unzip <path> on the ApkChecker CLI, or omitting the unzip path parameter when configuring the task programmatically in a Gradle plugin.","solutions":["Set the unzip path: pass -unzip <extracted-apk-dir> to ApkChecker or config.setUnzipPath(...) before running","Ensure the unzip step (ApkUnzipTask) ran before UnusedResourcesTask","Check the parameter key spelling in your task params map"],"exampleFix":"// before\nTaskConfig config = new TaskConfig();\n// after\nTaskConfig config = new TaskConfig();\nconfig.setUnzipPath(\"/tmp/apk-out\"); // must be set before UnusedResourcesTask.init()","handlingStrategy":"validation","validationCode":"if (config.getUnzipPath() == null || config.getUnzipPath().isEmpty()) {\n    throw new IllegalArgumentException(\"unzip path required for UnusedResourcesTask\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    job.addTask(TaskFactory.TASK_TYPE_UNUSED_RESOURCES, params);\n} catch (TaskInitException e) {\n    log.error(\"config error: \" + e.getMessage());\n}","preventionTips":["Validate all TaskConfig fields before building the job","Keep a fixed task setup helper that always sets unzip path","Unzip the APK as the first task in the job"],"tags":["android","apk-analysis","config"],"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"}