{"record":{"id":"b753e9e73c3dfe8d","repo":"Tencent/matrix","slug":"apk-unzip-path-can-not-be-null-b753e9","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/CountRTask.java","lineNumber":70,"sourceCode":"    private final List<String> dexFileNameList;\n    private final List<RandomAccessFile> dexFileList;\n    private final Map<String, Integer> classesMap;\n\n    public CountRTask(JobConfig config, Map<String, String> params) {\n        super(config, params);\n        type = TASK_TYPE_COUNT_R_CLASS;\n        dexFileNameList = new ArrayList<>();\n        dexFileList = new ArrayList<>();\n        classesMap = new HashMap<>();\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        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());\n                        RandomAccessFile randomAccessFile = new RandomAccessFile(file, \"rw\");\n                        dexFileList.add(randomAccessFile);","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/CountRTask.java#L52-L88","documentation":"CountRTask counts R-class resources in an unzipped APK. Like CountClassTask, its init() first runs the base checks then reads config.getUnzipPath(); if the path is null or empty (Util.isNullOrNil) it throws TaskInitException with this message because the task cannot locate the extracted APK contents without it.","triggerScenarios":"Executing CountRTask with a JobConfig whose unzip path property (APK-UNZIP-PATH) was never assigned or is set to an empty string.","commonSituations":"Same config-propagation gaps as CountClassTask: unzip step skipped, Gradle plugin property missing, key typo in config file, or building the JobConfig in custom tooling and forgetting setUnzipPath.","solutions":["Set config.setUnzipPath(...) to the extracted APK directory before running the task.","Ensure the unzip task in the canary job runs and stores its output path in the shared JobConfig.","Check your config/gradle properties for a missing or misspelled unzip-path entry.","Validate getUnzipPath() non-null/non-empty in your runner before execute()."],"exampleFix":"// before\nJobConfig config = new JobConfig(); // no unzip path set\n// after\nJobConfig config = new JobConfig();\nconfig.setUnzipPath(new File(\"build/apk-unzipped\").getAbsolutePath());","handlingStrategy":"validation","validationCode":"String unzipPath = config.getUnzipPath();\nif (unzipPath == null || unzipPath.trim().isEmpty()) {\n    throw new IllegalStateException(\"set APK-UNZIP-PATH before running CountRTask\");\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    countRTask.init();\n} catch (TaskInitException e) {\n    MatrixLog.e(TAG, \"CountRTask config invalid: %s\", e.getMessage());\n    throw e;\n}","preventionTips":["Run the unzip step before R-class counting tasks.","Set the unzip path programmatically from the unzip task's output, not by hand.","Validate all JobConfig fields once before the canary job starts.","Avoid typos by referencing config key constants."],"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"}