iBotPeaches/Apktool · error · AndrolibException
Repeated package group: id=0x%02x, name=%s
Error message
Repeated package group: id=0x%02x, name=%s
What it means
ResTable.addPackageGroup throws when a package group with the same package ID is registered twice while loading a resource table. This means the APK (or APK plus loaded framework/library tables) declares two packages that map to the same 0xNN package ID, which the table cannot represent.
Source
Thrown at brut.apktool/apktool-lib/src/main/java/brut/androlib/res/table/ResTable.java:161
}
}
public boolean hasPackageGroup(int id) {
return mPackageGroups.containsKey(id);
}
public ResPackageGroup getPackageGroup(int id) throws UndefinedResObjectException {
ResPackageGroup pkgGroup = mPackageGroups.get(id);
if (pkgGroup == null) {
throw new UndefinedResObjectException(String.format("package group: id=0x%02x", id));
}
return pkgGroup;
}
public ResPackageGroup addPackageGroup(int id, String name) throws AndrolibException {
ResPackageGroup pkgGroup = mPackageGroups.get(id);
if (pkgGroup != null) {
throw new AndrolibException(String.format("Repeated package group: id=0x%02x, name=%s", id, name));
}
// If the package ID is 0x00 and the main package is loaded, that means that a shared library is being loaded,
// so we change it to the reference package ID defined in the dynamic reference table, or assign it the next
// available ID.
if (id == 0 && mMainPackage != null) {
id = getDynamicRefPackageId(name);
if (id == 0) {
do {
id = mNextPackageId++;
} while (mDynamicRefTable.containsKey(id));
}
}
pkgGroup = new ResPackageGroup(this, id, name);
mPackageGroups.put(id, pkgGroup);
return pkgGroup;
}View on GitHub (pinned to 79b63384d7)
Solutions
- Update to the latest apktool release; duplicate-package handling has been improved over versions
- Decode with a clean framework setup: `apktool empty-framework-dir` then reinstall the correct framework (`apktool if framework-res.apk`) for the device's Android version
- If a custom framework tag is in play, make sure you are not loading two frameworks with the same package ID (use `-t` with distinct tags)
- Inspect the APK: `aapt dump resources app.apk` or unzip resources.arsc and check for repeated package chunks; if the APK itself is malformed, obtain the original
Example fix
# before apktool d app.apk # fails: Repeated package group: id=0x01 # after apktool empty-framework-dir apktool if framework-res.apk # pulled from the same device/ROM apktool d app.apk
Defensive patterns
Strategy: validation
Validate before calling
// Dump package IDs before full decode to spot duplicates
// `aapt dump resources app.apk | head` — look for repeated Package Groups
// or with apktool: decode with `--force-manifest` / verbose logging and inspect
// For programmatic use, load the table once in a probe:
try {
ResTable probe = new ResTable(new Config());
probe.loadPackageGroups ?? null; // full load will throw early with the duplicate id in the message
} catch (AndrolibException e) { /* message contains offending id */ } Try / catch
try {
decoder.decode(apk, out);
} catch (AndrolibException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Repeated package group")) {
// message shows the colliding id; clean framework dir and retry once with correct framework
} else { throw e; }
} Prevention
- Keep framework cache per device/ROM using -t tags instead of mixing
- Run `apktool empty-framework-dir` when switching between ROMs
- Use current apktool releases which handle more package layouts
When it happens
Trigger: Loading an APK whose resources.arsc contains duplicated package chunks with the same ID, or loading an APK whose package ID collides with an already-loaded framework/shared-library package (e.g. a renamed or repackaged framework-res injected into the APK).
Common situations: Decoding vendor/OEM APKs that bundle their own framework resources, decoding an APK against a custom framework installed with the same package ID, or processing APKs that were merged/rewritten by other tools producing duplicate package chunks.
Related errors
- Could not find resources.arsc in file:
- No packages in resources.arsc in file.
- Framework package not found: id=0x%02x
- Framework path is not a directory:
- Framework path's parent is not a directory:
AI-assisted analysis of iBotPeaches/Apktool@79b63384d7 (2026-08-14).
Data as JSON: /api/errors/d5f09d839b3fae2a.
Report an issue: GitHub.