{"record":{"id":"1ab310f2ae4ad152","repo":"Tencent/matrix","slug":"apk-unzip-path-can-not-be-null","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/CountClassTask.java","lineNumber":74,"sourceCode":"    private File inputFile;\n    private String group = JobConstants.GROUP_PACKAGE;\n    private final List<String> dexFileNameList;\n    private final List<RandomAccessFile> dexFileList;\n\n    public CountClassTask(JobConfig config, Map<String, String> params) {\n        super(config, params);\n        type = TASK_TYPE_COUNT_CLASS;\n        dexFileNameList = new ArrayList<>();\n        dexFileList = new ArrayList<>();\n    }\n\n    @Override\n    public void init() throws TaskInitException {\n        super.init();\n        String inputPath = config.getUnzipPath();\n\n        if (Util.isNullOrNil(inputPath)) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH can not be null!\");\n        }\n\n        Log.i(TAG, \"input path:%s\", inputPath);\n\n        inputFile = new File(inputPath);\n        if (!inputFile.exists()) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH '\" + inputPath + \"' is not exist!\");\n        }\n        if (!inputFile.isDirectory()) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH '\" + inputPath + \"' is not directory!\");\n        }\n\n        File[] files = inputFile.listFiles();\n        try {\n            if (files != null) {\n                for (File file : files) {\n                    if (file.isFile() && file.getName().endsWith(ApkConstants.DEX_FILE_SUFFIX)) {\n                        dexFileNameList.add(file.getName());","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/CountClassTask.java#L56-L92","documentation":"CountClassTask counts classes in an unzipped APK directory. After the base init() checks, it reads config.getUnzipPath(); if that path is null or empty (Util.isNullOrNil) it throws TaskInitException with this message, because the task cannot operate without the directory containing the extracted APK contents.","triggerScenarios":"Running CountClassTask with a JobConfig whose 'APK-UNZIP-PATH' (unzipPath) was never set, or set to an empty string, before execute()/init().","commonSituations":"Forgot to call the unzip step of the APK canary pipeline so no path was recorded in the config; Gradle plugin passes an empty property when the APK input wasn't resolved; typo in the config property key so the unzip path defaults to null.","solutions":["Set the APK-UNZIP-PATH config value (config.setUnzipPath(...) / job config property) to the directory of the unzipped APK before running the task.","Run the unzip step of the canary job first and feed its output path into the config.","Check the property name in your gradle/config file for typos or missing values.","Validate config.getUnzipPath() in your build script before invoking the matrix APK checker."],"exampleFix":"// before\nJobConfig config = new JobConfig();\ntask.setConfig(config);\n// after\nJobConfig config = new JobConfig();\nconfig.setUnzipPath(unzipDir.getAbsolutePath());\ntask.setConfig(config);","handlingStrategy":"validation","validationCode":"String unzipPath = config.getUnzipPath();\nif (unzipPath == null || unzipPath.trim().isEmpty()) {\n    throw new IllegalStateException(\"APK-UNZIP-PATH must be set before running CountClassTask\");\n}","typeGuard":"boolean hasUnzipPath(JobConfig config) {\n    String p = config == null ? null : config.getUnzipPath();\n    return p != null && !p.trim().isEmpty();\n}","tryCatchPattern":"try {\n    countClassTask.init();\n    countClassTask.execute();\n} catch (TaskInitException e) {\n    MatrixLog.e(TAG, \"unzip path misconfigured: %s\", e.getMessage());\n    throw e;\n}","preventionTips":["Always run and complete the unzip step before check tasks.","Set the unzip path via absolute File path, not ad-hoc strings.","Validate the config (path non-empty, directory exists) in your Gradle plugin before the job.","Keep config keys consistent; avoid hand-typed property names."],"tags":["apk-canary","task-init","missing-config","unzip-path"],"backgroundTag":"missing-config-value","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"}