{"record":{"id":"e73c0f277b480440","repo":"Tencent/matrix","slug":"apk-unzip-path-can-not-be-null-e73c0f","errorCode":null,"errorMessage":"---APK-UNZIP-PATH can not be null!","messagePattern":"---APK-UNZIP-PATH can not be null!","errorType":"validation","errorClass":"TaskInitException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/FindNonAlphaPngTask.java","lineNumber":71,"sourceCode":"    private static final String TAG = \"Matrix.FindNonAlphaPngTask\";\n\n    private File inputFile;\n    private List<Pair<String, Long>> nonAlphaPngList;\n    private long downLimitSize;\n    private Map<String, Pair<Long, Long>> entrySizeMap;\n    private Map<String, String> entryNameMap;\n\n    public FindNonAlphaPngTask(JobConfig config, Map<String, String> params) {\n        super(config, params);\n        type = TASK_TYPE_FIND_NON_ALPHA_PNG;\n    }\n\n    @Override\n    public void init() throws TaskInitException {\n        super.init();\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 exists!\");\n        } else if (!inputFile.isDirectory()) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH '\" + inputPath + \"' is not directory!\");\n        }\n        if (params.containsKey(JobConstants.PARAM_MIN_SIZE_IN_KB)) {\n            try {\n                downLimitSize = Long.parseLong(params.get(JobConstants.PARAM_MIN_SIZE_IN_KB));\n            } catch (NumberFormatException e) {\n                Log.e(TAG, \"DOWN-LIMIT-SIZE '\" + params.get(JobConstants.PARAM_MIN_SIZE_IN_KB) + \"' is not number format!\");\n            }\n        }\n        nonAlphaPngList = new ArrayList<Pair<String, Long>>();\n        entrySizeMap = config.getEntrySizeMap();\n        entryNameMap = config.getEntryNameMap();\n    }","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/FindNonAlphaPngTask.java#L53-L89","documentation":"FindNonAlphaPngTask throws TaskInitException during init() when config.getUnzipPath() is null or empty. This task scans PNG resources in the unzipped APK for non-alpha-channel images, and cannot run without the unzip location.","triggerScenarios":"Running FindNonAlphaPngTask (via ApkChecker task list) with JobConfig where PARAM_UNZIP_PATH is null or empty string.","commonSituations":"Omitting '--unzip <path>' from the ApkChecker command line; constructing config programmatically without setUnzipPath; config object reused/reset between tasks.","solutions":["Set the unzip path: '--unzip <dir>' on the CLI or config.setUnzipPath(path) before running.","Ensure UnzipTask executes before FindNonAlphaPngTask so the path is populated.","Assert config.getUnzipPath() != null in your build script before invoking ApkChecker."],"exampleFix":"// before\njava -jar ApkChecker.jar --task FindNonAlphaPng   # missing --unzip\n// after\njava -jar ApkChecker.jar --task FindNonAlphaPng --unzip /build/unzipped-apk","handlingStrategy":"validation","validationCode":"String unzipPath = config.getUnzipPath();\nif (unzipPath == null || unzipPath.trim().isEmpty()) {\n    throw new IllegalStateException(\"unzip path must be set before running FindNonAlphaPngTask\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    task.init();\n} catch (TaskInitException e) {\n    if (e.getMessage().contains(\"APK-UNZIP-PATH can not be null\")) {\n        config.setUnzipPath(extractedDir.getAbsolutePath());\n    }\n}","preventionTips":["Set --unzip on the CLI whenever FindNonAlphaPng is among the --task list.","Run UnzipTask before PNG-check tasks.","Assert config.getUnzipPath() in the wrapper script before invoking ApkChecker."],"tags":["android","apk-checker","config","png"],"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"}