shwenzhang/AndResGuard · error
Expected: 0x%08x, got: 0x%08x
Error message
Expected: 0x%08x, got: 0x%08x
What it means
ExtDataInput.skipCheckInt reads a 4-byte int from an Android resource (ARSC/AXML) stream and throws IOException if it does not equal the expected chunk/value. This is a strict structural sanity check used when parsing compiled binary resource files; a mismatch means the stream is not where the parser expects it to be.
Solutions
- Verify the input APK/ARSC is a valid, uncorrupted file (unzip -t)
- Check stream alignment: earlier read/skip calls must consume exactly the right byte counts
- Update AndResGuard to a version matching the build-tools/aapt version that produced the file
- Log both expected and got values (they are in the message) to identify which chunk header diverged
Example fix
// before
input.skipCheckInt(RES_TABLE_TYPE);
// after
int mark = peekedInt(input); // debug read of next int
if (mark != RES_TABLE_TYPE) {
throw new IOException("Stream misaligned, next int=0x" + Integer.toHexString(mark));
}
input.skipCheckInt(RES_TABLE_TYPE); Defensive patterns
Strategy: validation
Validate before calling
// validate the APK before parsing
Process p = new ProcessBuilder("unzip", "-t", apkPath).start();
if (p.waitFor() != 0) throw new IllegalStateException("APK corrupt: " + apkPath); Try / catch
try {
input.skipCheckInt(expected);
} catch (IOException e) {
if (e.getMessage().startsWith("Expected:")) {
throw new IOException("ARSC stream misaligned near chunk " + e.getMessage(), e);
}
throw e;
} Prevention
- Pin build-tools/aapt versions compatible with your AndResGuard version
- Validate APK integrity before processing
- Avoid running other APK-modifying tools before AndResGuard
When it happens
Trigger: Calling skipCheckInt(expected) on a stream whose next 4 bytes differ from expected — typically a wrong offset, a corrupted/truncated ARSC file, or a resource format produced by a different aapt version.
Common situations: Parsing an APK built with a newer/older aapt whose chunk layout differs; processing a corrupt or tampered APK; a bug in an earlier skip/read leaving the stream misaligned.
Understand the failure class
Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.
Related errors
- Expected: 0x%08x, got: 0x%08x
- Can't Generate signed APK. Plz check your v1sign info is…
- Can't Generate signed APK v2. Plz check your v2sign info is…
- Can not found any signed apk file
- can not found the raw apk file to zipalign, path=
AI-assisted analysis of shwenzhang/AndResGuard@e4df245d82 (2026-09-12).
Data as JSON: /api/errors/dd87a70e566706af.
Report an issue: GitHub.
Appendix: source
Thrown at AndResGuard-core/src/main/java/com/tencent/mm/util/ExtDataInput.java:49
super(delegate);
}
public int[] readIntArray(int length) throws IOException {
int[] array = new int[length];
for (int i = 0; i < length; i++) {
array[i] = readInt();
}
return array;
}
public void skipInt() throws IOException {
skipBytes(4);
}
public void skipCheckInt(int expected) throws IOException {
int got = readInt();
if (got != expected) {
throw new IOException(String.format("Expected: 0x%08x, got: 0x%08x", expected, got));
}
}
public void skipCheckChunkTypeInt(int expected, int possible) throws IOException {
int got = readInt();
if (got == possible) {
skipCheckChunkTypeInt(expected, -1);
} else if (got != expected) {
throw new IOException(String.format("Expected: 0x%08x, got: 0x%08x", expected, got));
}
}
public void skipCheckShort(short expected) throws IOException {
short got = readShort();
if (got != expected) {
throw new IOException(String.format("Expected: 0x%08x, got: 0x%08x", expected, got));
}View on GitHub (pinned to e4df245d82)