{"record":{"id":"a30c31edd7c391d4","repo":"Tencent/matrix","slug":"tag-apk-file-path-can-not-be-null","errorCode":null,"errorMessage":"TAG + \"---APK-FILE-PATH can not be null!\"","messagePattern":"TAG \\+ \"---APK-FILE-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/UncompressedFileTask.java","lineNumber":66,"sourceCode":"    private static final String TAG = \"Matrix.UncompressedFileTask\";\n\n    private File inputFile;\n    private Set<String> filterSuffix;\n    private Map<String, Long> uncompressSizeMap;\n    private Map<String, Long> compressSizeMap;\n\n    public UncompressedFileTask(JobConfig config, Map<String, String> params) {\n        super(config, params);\n        type = TASK_TYPE_UNCOMPRESSED_FILE;\n    }\n\n    @Override\n    public void init() throws TaskInitException {\n        super.init();\n        String inputPath = config.getApkPath();\n\n        if (Util.isNullOrNil(inputPath)) {\n            throw new TaskInitException(TAG + \"---APK-FILE-PATH can not be null!\");\n        }\n        inputFile = new File(inputPath);\n        if (!FileUtil.isLegalFile(inputFile)) {\n            throw new TaskInitException(TAG + \"---APK-FILE-PATH '\" + inputPath + \"' is illegal!\");\n        }\n\n        filterSuffix = new HashSet<>();\n\n        if (params.containsKey(JobConstants.PARAM_SUFFIX) && !Util.isNullOrNil(params.get(JobConstants.PARAM_SUFFIX))) {\n            String[]  suffix = params.get(JobConstants.PARAM_SUFFIX).split(\",\");\n            for (String suffixStr : suffix) {\n                filterSuffix.add(suffixStr.trim());\n            }\n        }\n\n        uncompressSizeMap = new HashMap<>();\n        compressSizeMap = new HashMap<>();\n    }","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UncompressedFileTask.java#L48-L84","documentation":"UncompressedFileTask.init() throws TaskInitException when the APK file path (config.getApkPath(), APK-FILE-PATH) is null or empty. This task scans the APK for uncompressed file entries and needs the original APK file to open.","triggerScenarios":"Creating the job with a MatrixConfig that never sets the APK path; calling config.getApkPath() returning null because the --apk flag was omitted.","commonSituations":"Forgetting the APK path argument in a gradle- or CLI-invoked matrix run; building config programmatically and omitting setApkPath; refactoring config keys.","solutions":["Set the APK path via config.setApkPath(\"/path/to/app.apk\") or pass the APK path flag on the CLI.","Validate the path is non-null/non-empty before constructing the job.","Ensure the APK was built and exists at the expected CI workspace location."],"exampleFix":"// before\nargs.put(JobConstants.PARAM_APK_PATH, null);\n// after\nFile apk = new File(\"app/build/outputs/apk/release/app-release.apk\");\nif (apk.isFile()) args.put(JobConstants.PARAM_APK_PATH, apk.getAbsolutePath());","handlingStrategy":"validation","validationCode":"String apkPath = config.getApkPath();\nif (apkPath == null || apkPath.trim().isEmpty()) {\n    throw new IllegalStateException(\"APK path must be set before running UncompressedFileTask\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    job.run();\n} catch (TaskInitException e) {\n    if (e.getMessage().contains(\"APK-FILE-PATH can not be null\")) {\n        log.error(\"Set --apk / config.setApkPath() before running this task\");\n    } else throw e;\n}","preventionTips":["Wire the APK path from the gradle build output automatically.","Validate required config keys centrally before constructing tasks.","Fail the build early if the APK output doesn't exist.","Keep matrix config keys in one reviewed location."],"tags":["android","apk-canary","config","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"}