Tencent/matrix · error · TaskInitException
TAG + "---APK-FILE-PATH can not be null!"
Error message
TAG + "---APK-FILE-PATH can not be null!"
What it means
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.
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.
Example fix
// before
args.put(JobConstants.PARAM_APK_PATH, null);
// after
File apk = new File("app/build/outputs/apk/release/app-release.apk");
if (apk.isFile()) args.put(JobConstants.PARAM_APK_PATH, apk.getAbsolutePath()); Defensive patterns
Strategy: validation
Validate before calling
String apkPath = config.getApkPath();
if (apkPath == null || apkPath.trim().isEmpty()) {
throw new IllegalStateException("APK path must be set before running UncompressedFileTask");
} Try / catch
try {
job.run();
} catch (TaskInitException e) {
if (e.getMessage().contains("APK-FILE-PATH can not be null")) {
log.error("Set --apk / config.setApkPath() before running this task");
} else throw e;
} Prevention
- 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.
When it happens
Trigger: Creating the job with a MatrixConfig that never sets the APK path; calling config.getApkPath() returning null because the --apk flag was omitted.
Common situations: Forgetting the APK path argument in a gradle- or CLI-invoked matrix run; building config programmatically and omitting setApkPath; refactoring config keys.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- TAG + "---The path of tool 'nm' is not given!"
- TAG + "---APK-UNZIP-PATH can not be null!"
- TAG + "---APK-UNZIP-PATH can not be null!"
- TAG + "---APK-UNZIP-PATH '" + inputPath + "' is not…
- ---APK-UNZIP-PATH can not be null!
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/a30c31edd7c391d4.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UncompressedFileTask.java:66
private static final String TAG = "Matrix.UncompressedFileTask";
private File inputFile;
private Set<String> filterSuffix;
private Map<String, Long> uncompressSizeMap;
private Map<String, Long> compressSizeMap;
public UncompressedFileTask(JobConfig config, Map<String, String> params) {
super(config, params);
type = TASK_TYPE_UNCOMPRESSED_FILE;
}
@Override
public void init() throws TaskInitException {
super.init();
String inputPath = config.getApkPath();
if (Util.isNullOrNil(inputPath)) {
throw new TaskInitException(TAG + "---APK-FILE-PATH can not be null!");
}
inputFile = new File(inputPath);
if (!FileUtil.isLegalFile(inputFile)) {
throw new TaskInitException(TAG + "---APK-FILE-PATH '" + inputPath + "' is illegal!");
}
filterSuffix = new HashSet<>();
if (params.containsKey(JobConstants.PARAM_SUFFIX) && !Util.isNullOrNil(params.get(JobConstants.PARAM_SUFFIX))) {
String[] suffix = params.get(JobConstants.PARAM_SUFFIX).split(",");
for (String suffixStr : suffix) {
filterSuffix.add(suffixStr.trim());
}
}
uncompressSizeMap = new HashMap<>();
compressSizeMap = new HashMap<>();
}View on GitHub (pinned to 3b8293bd65)