{"record":{"id":"40cefe2e3464d5c0","repo":"Tencent/matrix","slug":"tag-apk-unzip-path-can-not-be-null-40cefe","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/UnStrippedSoCheckTask.java","lineNumber":89,"sourceCode":"            while (matcher.find()) {\n                if (!Util.isNullOrNil(matcher.group())) {\n                    String env = System.getenv(matcher.group().substring(1));\n                    Log.d(TAG, \"%s -> %s\", matcher.group().substring(1), env);\n                    if (!Util.isNullOrNil(env)) {\n                        toolnmPath = toolnmPath.replace(matcher.group(), env);\n                    }\n                }\n            }\n            Log.i(TAG, \"toolnm pah is %s\", toolnmPath);\n        }\n        if (!FileUtil.isLegalFile(toolnmPath)) {\n            throw new TaskInitException(TAG + \"---Can not find the tool 'nm'!\");\n        }\n        if (!Util.isNullOrNil(inputPath)) {\n            Log.i(TAG, \"inputPath:%s\", inputPath);\n            libDir = new File(inputPath, \"lib\");\n        } else {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH can not be null!\");\n        }\n\n    }\n\n    private boolean isSoStripped(File libFile) throws IOException, InterruptedException {\n        ProcessBuilder processBuilder = new ProcessBuilder(toolnmPath, libFile.getAbsolutePath());\n        Process process = processBuilder.start();\n        BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));\n        String line = reader.readLine();\n        boolean result = false;\n        if (!Util.isNullOrNil(line)) {\n            Log.d(TAG, \"%s\", line);\n            String[] columns = line.split(\":\");\n            if (columns.length == 3 && columns[2].trim().equalsIgnoreCase(\"no symbols\")) {\n                result = true;\n            }\n        }\n        reader.close();","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnStrippedSoCheckTask.java#L71-L107","documentation":"UnStrippedSoCheckTask.init() throws TaskInitException when the unzipped APK directory (config.getUnzipPath(), the APK-UNZIP-PATH config) is null or empty. The task needs the lib/ directory of the unzipped APK to scan .so files.","triggerScenarios":"Launching the so-stripping check job without running the unzip step first, or without setting APK-UNZIP-PATH in the MatrixConfig.","commonSituations":"Wiring only the APK path but forgetting the unzip path; running UnStrippedSoCheckTask standalone in tests; CI pipeline reordering so the unzip task output dir is not propagated.","solutions":["Set the unzip path in MatrixConfig (or the CLI equivalent) to the directory of the unzipped APK before running the job.","Ensure the unzip task runs earlier in the task pipeline so getUnzipPath() is populated.","Verify the unzip output directory actually contains lib/ with .so files."],"exampleFix":"// before\nMatrixConfig config = new MatrixConfig.Builder().setApkPath(apk).build();\n// after\nMatrixConfig config = new MatrixConfig.Builder().setApkPath(apk).setApkUnzipPath(unzipDir).build();","handlingStrategy":"validation","validationCode":"String unzipPath = config.getApkUnzipPath();\nif (unzipPath == null || unzipPath.isEmpty() || !new File(unzipPath, \"lib\").isDirectory()) {\n    throw new IllegalStateException(\"APK-UNZIP-PATH missing or has no lib/ dir\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    job.run();\n} catch (TaskInitException e) {\n    if (e.getMessage().contains(\"APK-UNZIP-PATH can not be null\")) {\n        runUnzipTaskFirst();\n    } else throw e;\n}","preventionTips":["Always run the unzip task before so-stripping checks in the same pipeline.","Keep unzip output and analysis tasks in one job workspace.","Validate config fields at job-construction time.","Store paths as absolute values in CI configs."],"tags":["android","apk-canary","config","unzip-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"}