{"record":{"id":"153b06358a2b216e","repo":"iBotPeaches/Apktool","slug":"framework-package-not-found-id-0x-02x","errorCode":null,"errorMessage":"Framework package not found: id=0x%02x","messagePattern":"Framework package not found: id=0x%02x","errorType":"exception","errorClass":"AndrolibException","httpStatus":null,"severity":"error","filePath":"brut.apktool/apktool-lib/src/main/java/brut/androlib/res/table/ResTable.java","lineNumber":247,"sourceCode":"        ResPackageGroup pkgGroup = mPackageGroups.get(id);\n        if (pkgGroup == null) {\n            throw new AndrolibException(String.format(\"Library package not found: id=0x%02x\", id));\n        }\n\n        mLibPackageIds.add(id);\n        return pkgGroup;\n    }\n\n    private ResPackageGroup loadFrameworkById(int id) throws AndrolibException {\n        if (mFramePackageIds.contains(id)) {\n            return mPackageGroups.get(id);\n        }\n\n        loadPackagesFromApk(new Framework(mConfig).getApkFile(id));\n\n        ResPackageGroup pkgGroup = mPackageGroups.get(id);\n        if (pkgGroup == null) {\n            throw new AndrolibException(String.format(\"Framework package not found: id=0x%02x\", id));\n        }\n\n        mFramePackageIds.add(id);\n        return pkgGroup;\n    }\n\n    private void loadPackagesFromApk(File apkFile) throws AndrolibException {\n        Log.i(TAG, \"Loading resource table from file: \" + apkFile);\n        try (ZipRODirectory zipDir = new ZipRODirectory(apkFile)) {\n            loadPackagesFromApk(apkFile, zipDir, false);\n        } catch (DirectoryException ex) {\n            throw new AndrolibException(\"Could not open apk file: \" + apkFile, ex);\n        }\n    }\n\n    public ResEntrySpec resolve(ResId resId) throws AndrolibException {\n        return resolvePackageGroup(resId.pkgId()).getEntrySpec(resId.typeId(), resId.entryId());\n    }","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/iBotPeaches/Apktool/blob/79b63384d7d7e22917e6ea8b453272da7012515b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/table/ResTable.java#L229-L265","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\napktool d oem-app.apk   # Framework package not found: id=0x01\n\n# after\nadb pull /system/framework/framework-res.apk\napktool empty-framework-dir\napktool if framework-res.apk\napktool d oem-app.apk","handlingStrategy":"try-catch","validationCode":"// Ensure the framework apk for the expected id exists and contains the package\nFile fw = new Framework(new Config()).getApkFile(1);\nif (!fw.isFile()) {\n    throw new IllegalStateException(\"Framework 1.apk not installed — run `apktool if framework-res.apk`\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    decoder.decode(apk, out);\n} catch (AndrolibException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Framework package not found\")) {\n        // reinstall matching framework then retry once\n    } else { throw e; }\n}","preventionTips":["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"],"tags":["apktool","framework","package-id","decode"],"backgroundTag":null,"analyzedSha":"79b63384d7d7e22917e6ea8b453272da7012515b","analyzedAt":"2026-08-14T10:43:28.812Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}