Tencent/matrix · error · TaskInitException
TAG + "---APK-UNZIP-PATH can not be null!"
Error message
TAG + "---APK-UNZIP-PATH can not be null!"
What it means
UnusedResourcesTask.init() throws TaskInitException when the configured APK unzip path is null or empty. The task needs the extracted APK directory to scan resources. This is a required-configuration check performed before the task runs.
Solutions
- Set the unzip path: pass -unzip <extracted-apk-dir> to ApkChecker or config.setUnzipPath(...) before running
- Ensure the unzip step (ApkUnzipTask) ran before UnusedResourcesTask
- Check the parameter key spelling in your task params map
Example fix
// before
TaskConfig config = new TaskConfig();
// after
TaskConfig config = new TaskConfig();
config.setUnzipPath("/tmp/apk-out"); // must be set before UnusedResourcesTask.init() Defensive patterns
Strategy: validation
Validate before calling
if (config.getUnzipPath() == null || config.getUnzipPath().isEmpty()) {
throw new IllegalArgumentException("unzip path required for UnusedResourcesTask");
} Try / catch
try {
job.addTask(TaskFactory.TASK_TYPE_UNUSED_RESOURCES, params);
} catch (TaskInitException e) {
log.error("config error: " + e.getMessage());
} Prevention
- Validate all TaskConfig fields before building the job
- Keep a fixed task setup helper that always sets unzip path
- Unzip the APK as the first task in the job
When it happens
Trigger: JobConstants.PARAM_UNZIP_PATH / config.getUnzipPath() not set when adding UnusedResourcesTask to an ApkChecker job.
Common situations: Forgetting to pass -unzip <path> on the ApkChecker CLI, or omitting the unzip path parameter when configuring the task programmatically in a Gradle plugin.
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
- ---APK-UNZIP-PATH can not be null!
- ---APK-UNZIP-PATH can not be null!
- ---APK-UNZIP-PATH can not be null!
- TAG + "---The path of tool 'nm' is not given!"
- TAG + "---APK-UNZIP-PATH can not be null!"
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/54e06686150e0d3d.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnusedResourcesTask.java:105
dexFileNameList = new ArrayList<>();
ignoreSet = new HashSet<>();
rclassProguardMap = new HashMap<>();
resguardMap = new HashMap<>();
resourceDefMap = new HashMap<>();
styleableMap = new HashMap<>();
resourceRefSet = new HashSet<>();
unusedResSet = new HashSet<>();
nonValueReferences = new HashMap<>();
visitPath = new Stack<String>();
}
@Override
public void init() throws TaskInitException {
super.init();
String inputPath = config.getUnzipPath();
if (Util.isNullOrNil(inputPath)) {
throw new TaskInitException(TAG + "---APK-UNZIP-PATH can not be null!");
}
if (!params.containsKey(JobConstants.PARAM_R_TXT) || Util.isNullOrNil(params.get(JobConstants.PARAM_R_TXT))) {
throw new TaskInitException(TAG + "---The File 'R.txt' can not be null!");
}
resourceTxt = new File(params.get(JobConstants.PARAM_R_TXT));
if (!FileUtil.isLegalFile(resourceTxt)) {
throw new TaskInitException(TAG + "---The Resource declarations file 'R.txt' is not legal!");
}
inputFile = new File(inputPath);
if (!inputFile.exists()) {
throw new TaskInitException(TAG + "---APK-UNZIP-PATH '" + inputPath + "' is not exist!");
} else if (!inputFile.isDirectory()) {
throw new TaskInitException(TAG + "---APK-UNZIP-PATH '" + inputPath + "' is not directory!");
}
if (!Util.isNullOrNil(config.getMappingFilePath())) {
mappingTxt = new File(config.getMappingFilePath());
if (!FileUtil.isLegalFile(mappingTxt)) {
throw new TaskInitException(TAG + "---The Proguard mapping file 'mapping.txt' is not legal!");View on GitHub (pinned to 3b8293bd65)