shwenzhang/AndResGuard · error · brut.androlib.AndrolibException
Config size < 28
Error message
Config size < 28
What it means
RawARSCDecoder.readConfigFlags mirrors ARSCDecoder's check in the raw name-collection pass: each TYPE config must declare a size of at least 28 bytes (the minimal ResTable_config). A smaller value means the config chunk is malformed or the raw stream is misaligned, so the pre-scan of the arsc aborts.
Solutions
- Rebuild the APK's resources.arsc with official aapt/aapt2 and retry
- Start from the original, unmodified APK rather than a repacked one
- Validate with aapt dump resources to locate the malformed config
- Upgrade AndResGuard for broader arsc compatibility
Example fix
// before: repacked apk from a third-party store tool AndResGuard.process(repackedApk) // after: use the original build artifact AndResGuard.process(originalReleaseApk)
Defensive patterns
Strategy: try-catch
Validate before calling
// validate arsc before the raw name pre-scan // aapt dump resources app.apk — aborts the pipeline if the arsc is malformed
Try / catch
try {
RawARSCDecoder.decode(arscStream);
} catch (AndrolibException e) {
if (e.getMessage().contains("Config size < 28")) {
throw new BuildException("Malformed arsc config; rebuild with official aapt2", e);
}
throw e;
} Prevention
- Only process APKs from the official build pipeline
- Avoid pre-repacked inputs (third-party store tools, double obfuscation)
- Add aapt dump resources as a CI pre-check
- Update AndResGuard for arsc variant tolerance
When it happens
Trigger: During readConfig -> readConfigFlags, mIn.readInt() returns a config size < 28, caused by a non-standard/malformed resources.arsc or by earlier chunks being consumed with wrong lengths in the raw pass.
Common situations: APKs repacked by third-party tools, arsc files built with non-aapt generators, corrupted downloads, or double-processed (already obfuscated) APKs.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Config size < 28
- Could not decode arsc file
- Invalid chunk type: expected=0x%08x, got=0x%08x
- Invalid chunk type: expected=
- readAndWriteHeader size < 0: size=
AI-assisted analysis of shwenzhang/AndResGuard@e4df245d82 (2026-09-12).
Data as JSON: /api/errors/f3a2b0d27c533bfa.
Report an issue: GitHub.
Appendix: source
Thrown at AndResGuard-core/src/main/java/com/tencent/mm/androlib/res/decoder/RawARSCDecoder.java:241
mIn.readInt();
readValue(flags, specNamesId);
}
}
private void readValue(boolean flags, int specNamesId) throws IOException, AndrolibException {
/* size */
mIn.skipCheckShort((short) 8);
/* zero */
mIn.skipCheckByte((byte) 0);
byte type = mIn.readByte();
int data = mIn.readInt();
}
private void readConfigFlags() throws IOException, AndrolibException {
int read = 28;
int size = mIn.readInt();
if (size < 28) {
throw new AndrolibException("Config size < 28");
}
boolean isInvalid = false;
short mcc = mIn.readShort();
short mnc = mIn.readShort();
char[] language = new char[] { (char) mIn.readByte(), (char) mIn.readByte() };
char[] country = new char[] { (char) mIn.readByte(), (char) mIn.readByte() };
byte orientation = mIn.readByte();
byte touchscreen = mIn.readByte();
int density = mIn.readUnsignedShort();
byte keyboard = mIn.readByte();
byte navigation = mIn.readByte();
byte inputFlags = mIn.readByte();
/* inputPad0 */
mIn.skipBytes(1);
short screenWidth = mIn.readShort();
short screenHeight = mIn.readShort();View on GitHub (pinned to e4df245d82)