Tencent/tinker · error · TinkerRuntimeException

res meta Corrupted:

Error message

res meta Corrupted:

What it means

ShareResPatchInfo.parseResPatchInfoFirstLine splits the first line of res_meta.txt and requires it non-empty. An empty first line (after split) throws TinkerRuntimeException("res meta Corrupted:" + meta). Additionally the code then indexes kv[1] and kv[2] without length checks, so malformed lines surface as AIOOBE right after. Either way the resource patch meta is not in the expected 'dir,arscCrc,resArscMd5' format.

Source

Thrown at tinker-android/tinker-android-loader/src/main/java/com/tencent/tinker/loader/shareutil/ShareResPatchInfo.java:161

        if (input.contains("?")) {
            input = input.replaceAll("\\?", "\\.");
        }
        //convert * to.*
        if (input.contains("*")) {
            input = input.replace("*", ".*");
        }
        Pattern pattern = Pattern.compile(input);
        return pattern;
    }

    public static void parseResPatchInfoFirstLine(String meta, ShareResPatchInfo info) {
        if (meta == null || meta.length() == 0) {
            return;
        }
        String[] lines = meta.split("\n");
        String firstLine = lines[0];
        if (firstLine == null || firstLine.length() <= 0) {
            throw new TinkerRuntimeException("res meta Corrupted:" + meta);
        }
        final String[] kv = firstLine.split(",", 3);
        info.arscBaseCrc = kv[1];
        info.resArscMd5 = kv[2];
    }

    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append("resArscMd5:" + resArscMd5 + "\n");
        sb.append("arscBaseCrc:" + arscBaseCrc + "\n");

        for (Pattern pattern : patterns) {
            sb.append("pattern:" + pattern + "\n");
        }
        for (String add : addRes) {
            sb.append("addedSet:" + add + "\n");
        }

View on GitHub (pinned to 1b7ea02c23)

Solutions

  1. Match the gradle plugin and loader versions and rebuild the patch.
  2. Never edit files inside the produced patch package.
  3. Pre-validate the meta line: non-empty and split(',').length >= 3 before calling.
  4. Catch TinkerRuntimeException during patch load and reject the package as corrupted.

Example fix

// before
String firstLine = lines[0];
// after
String firstLine = lines[0];
if (firstLine == null || firstLine.trim().isEmpty() || firstLine.split(",").length < 3) {
    throw new TinkerRuntimeException("res meta Corrupted:" + meta);
}
Defensive patterns

Strategy: validation

Validate before calling

String firstLine = meta.split("\n")[0];
if (firstLine == null || firstLine.trim().isEmpty() || firstLine.split(",", -1).length < 3) {
    // reject resource patch before parseResPatchInfoFirstLine
}

Try / catch

try {
    ShareResPatchInfo.parseResPatchInfoFirstLine(meta, info);
} catch (TinkerRuntimeException | ArrayIndexOutOfBoundsException e) {
    // corrupted res meta: reject patch package
}

Prevention

When it happens

Trigger: parseResPatchInfoFirstLine(meta, info) with a meta whose first line is empty, whitespace, or has fewer than 3 comma-separated fields.

Common situations: Patch built by a mismatched plugin/loader version; edited or corrupted res_meta.txt; a patch containing only resource changes produced by a nonstandard pipeline.

Related errors


AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14). Data as JSON: /api/errors/1d5e571e34d8924e. Report an issue: GitHub.