Tencent/matrix · error · TaskExecuteException
<e.getMessage()>
Error message
<e.getMessage()>
What it means
UnusedResourcesTask.call() wraps any Exception thrown while computing unused resources into a TaskExecuteException with e.getMessage() as the message and the original as cause. Like UnusedAssetsTask, it is a generic wrapper; the actionable info is in the cause.
Solutions
- Inspect TaskExecuteException.getCause() for the real failure
- Validate R.txt and mapping files are readable and well-formed before the task
- If the cause is 'Found resource cycle!', break the cycle or ignore those resources
- Re-extract the APK and re-run to rule out corrupted input
Example fix
// before
throw new TaskExecuteException(e.getMessage(), e);
// after
throw new TaskExecuteException("UnusedResourcesTask failed: " + e, e); Defensive patterns
Strategy: try-catch
Validate before calling
File rTxt = new File(params.get(JobConstants.PARAM_R_TXT));
File dir = new File(config.getUnzipPath());
if (!rTxt.isFile() || !dir.isDirectory()) throw new IllegalStateException("invalid inputs for unused-resources task"); Try / catch
try {
TaskResult r = task.call();
} catch (TaskExecuteException e) {
Throwable cause = e.getCause();
log.error("unused-resources failed", cause != null ? cause : e);
} Prevention
- Always log getCause(), the wrapper message can be null or unhelpful
- Pre-validate R.txt, mapping, and unzip directory before the job
- Re-extract the APK if inputs may be stale or corrupted
When it happens
Trigger: Any exception during call(): file IO while scanning res/ directories, parsing R.txt/mapping files, JSON result building, or the resource-cycle IllegalStateException from readChildReference().
Common situations: Missing/odd res directory contents, malformed R.txt or mapping files, cyclic resources, or unreadable files in the extracted APK on CI.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- e.getMessage()
- e.getMessage()
- e.getMessage()
- TAG + "---APK-UNZIP-PATH can not be null!"
- TAG + "---The File 'R.txt' can not be null!"
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/2404ca5bf23f0d11.
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:498
unusedResSet.addAll(resourceDefMap.values());
Log.i(TAG, "find resource declarations %d items.", unusedResSet.size());
decodeCode();
Log.i(TAG, "find resource references in classes: %d items.", resourceRefSet.size());
decodeResources();
Log.i(TAG, "find resource references %d items.", resourceRefSet.size());
unusedResSet.removeAll(resourceRefSet);
Log.i(TAG, "find unused references %d items", unusedResSet.size());
Log.d(TAG, "find unused references %s", unusedResSet.toString());
JsonArray jsonArray = new JsonArray();
for (String name : unusedResSet) {
jsonArray.add(name);
}
((TaskJsonResult) taskResult).add("unused-resources", jsonArray);
taskResult.setStartTime(startTime);
taskResult.setEndTime(System.currentTimeMillis());
return taskResult;
} catch (Exception e) {
throw new TaskExecuteException(e.getMessage(), e);
}
}
}
View on GitHub (pinned to 3b8293bd65)