iBotPeaches/Apktool · error · AndrolibException
Framework package not found: id=0x%02x
Error message
Framework package not found: id=0x%02x
What it means
ResTable.loadFrameworkById loaded the framework APK for a package ID (typically 0x01 for android) but the loaded table still has no group with that ID. In practice the installed framework file does not contain the package the APK was compiled against, i.e. a framework/device mismatch.
Source
Thrown at brut.apktool/apktool-lib/src/main/java/brut/androlib/res/table/ResTable.java:247
ResPackageGroup pkgGroup = mPackageGroups.get(id);
if (pkgGroup == null) {
throw new AndrolibException(String.format("Library package not found: id=0x%02x", id));
}
mLibPackageIds.add(id);
return pkgGroup;
}
private ResPackageGroup loadFrameworkById(int id) throws AndrolibException {
if (mFramePackageIds.contains(id)) {
return mPackageGroups.get(id);
}
loadPackagesFromApk(new Framework(mConfig).getApkFile(id));
ResPackageGroup pkgGroup = mPackageGroups.get(id);
if (pkgGroup == null) {
throw new AndrolibException(String.format("Framework package not found: id=0x%02x", id));
}
mFramePackageIds.add(id);
return pkgGroup;
}
private void loadPackagesFromApk(File apkFile) throws AndrolibException {
Log.i(TAG, "Loading resource table from file: " + apkFile);
try (ZipRODirectory zipDir = new ZipRODirectory(apkFile)) {
loadPackagesFromApk(apkFile, zipDir, false);
} catch (DirectoryException ex) {
throw new AndrolibException("Could not open apk file: " + apkFile, ex);
}
}
public ResEntrySpec resolve(ResId resId) throws AndrolibException {
return resolvePackageGroup(resId.pkgId()).getEntrySpec(resId.typeId(), resId.entryId());
}View on GitHub (pinned to 79b63384d7)
Solutions
- Pull framework-res.apk from the same device/ROM (adb pull /system/framework/framework-res.apk) and install it: `apktool if framework-res.apk`
- Clear the framework cache first if it may be stale/corrupt: `apktool empty-framework-dir`, then reinstall the correct framework
- If you intentionally keep multiple frameworks, install with a tag and decode with the matching `-t <tag>`
- Update apktool — newer releases bundle/expect frameworks matching newer package layouts
Example fix
# before apktool d oem-app.apk # Framework package not found: id=0x01 # after adb pull /system/framework/framework-res.apk apktool empty-framework-dir apktool if framework-res.apk apktool d oem-app.apk
Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure the framework apk for the expected id exists and contains the package
File fw = new Framework(new Config()).getApkFile(1);
if (!fw.isFile()) {
throw new IllegalStateException("Framework 1.apk not installed — run `apktool if framework-res.apk`");
} Try / catch
try {
decoder.decode(apk, out);
} catch (AndrolibException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Framework package not found")) {
// reinstall matching framework then retry once
} else { throw e; }
} Prevention
- Install framework-res.apk pulled from the exact device before decoding OEM APKs
- Use `apktool empty-framework-dir` when framework versions change
- Pin framework tags with -t per ROM to avoid cross-ROM contamination
When it happens
Trigger: Decoding an APK built against a framework whose package ID differs from the framework apktool has cached (1.apk), or a corrupted/empty cached framework file, so after loadPackagesFromApk the expected ID is absent.
Common situations: Decoding an OEM APK pulled from a new device while apktool's framework dir still holds an older or generic framework; decoding with `-t` tag pointing at the wrong stored framework; framework cache corruption after interrupted runs.
Related errors
- Could not find framework resources for package ID {pkgId}. Y
- Repeated package group: id=0x%02x, name=%s
- Input file (" + path + ") was not found or was not readable.
- Destination directory (" + path + ") already exists. Use -f
- Could not find resources.arsc in file:
AI-assisted analysis of iBotPeaches/Apktool@79b63384d7 (2026-08-14).
Data as JSON: /api/errors/153b06358a2b216e.
Report an issue: GitHub.