{"record":{"id":"8b2b05bb6e8904d0","repo":"iBotPeaches/Apktool","slug":"could-not-find-framework-resources-for-package-id","errorCode":null,"errorMessage":"Could not find framework resources for package ID {pkgId}.\nYou must install proper framework files, see project website for more info.","messagePattern":"Could not find framework resources for package ID (.+?)\\.\nYou must install proper framework files, see project website for more info\\.","errorType":"exception","errorClass":"FrameworkNotFoundException","httpStatus":null,"severity":"error","filePath":"brut.apktool/apktool-lib/src/main/java/brut/androlib/res/Framework.java","lineNumber":192,"sourceCode":"        }\n\n        // Fall back to the untagged framework.\n        apkFile = new File(dir, id + getApkSuffix(null));\n        if (apkFile.exists()) {\n            return apkFile;\n        }\n\n        // If the default framework is requested but is missing, extract the built-in one.\n        if (id == 1) {\n            try {\n                BrutIO.copyAndClose(getAndroidFrameworkAsStream(), Files.newOutputStream(apkFile.toPath()));\n            } catch (IOException ex) {\n                throw new AndrolibException(ex);\n            }\n            return apkFile;\n        }\n\n        throw new FrameworkNotFoundException(id);\n    }\n\n    private String getApkSuffix() {\n        return getApkSuffix(mConfig.getFrameworkTag());\n    }\n\n    private static String getApkSuffix(String tag) {\n        return ((tag != null && !tag.isEmpty()) ? \"-\" + tag : \"\") + \".apk\";\n    }\n\n    private InputStream getAndroidFrameworkAsStream() {\n        return getClass().getResourceAsStream(\"/prebuilt/android-framework.jar\");\n    }\n\n    public void cleanDirectory() throws AndrolibException {\n        for (File apkFile : listDirectory()) {\n            Log.i(TAG, \"Removing framework file: \" + apkFile.getName());\n            OS.rmfile(apkFile);","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/iBotPeaches/Apktool/blob/79b63384d7d7e22917e6ea8b453272da7012515b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/Framework.java#L174-L210","documentation":"FrameworkNotFoundException thrown by Framework.getApkFile() when a framework with the requested package id is absent from the framework directory. During decode, apps referencing OEM frameworks (package ids >= 2, e.g. HTC/Samsung/MIUI resources) need the matching <id>-<tag>.apk installed beforehand. Id 1 is special-cased: if the default android framework is missing, the bundled android-framework.jar is auto-extracted, so this error only escapes for non-system ids.","triggerScenarios":"Decoding an OEM app whose resources.arsc declares a package with id >= 2 while the framework directory lacks the corresponding <pkgId>.apk; using a framework tag (-t) for which no <pkgId>-<tag>.apk was installed; framework dir emptied (e.g. after `apktool empty-framework-dir`).","commonSituations":"Decoding vendor/system apps (HTC SenseUI, Samsung OneUI, Flyme) without first running `apktool if <oem-framework>.apk`; CI containers with fresh HOME and no preinstalled frameworks; switching framework tags.","solutions":["Fetch the matching OEM framework APK from the device/ROM (e.g. /system/framework/framework-res.apk or com.htc.resources.apk) and run `apktool if <file.apk>`.","If the framework was installed under a tag, decode with the same tag: `apktool d -t <tag> app.apk`.","Confirm the installed file name matches <pkgId>.apk in the framework dir (ls the --frame-path)."],"exampleFix":"# before\napktool d com.htc.app.apk        # needs HTC framework (id 15)\n# after\nadb pull /system/framework/com.htc.resources.apk .\napktool if com.htc.resources.apk\napktool d com.htc.app.apk","handlingStrategy":"try-catch","validationCode":"int pkgId = 2; // from the app's resources.arsc\nFile fw = new File(frameworkDir, pkgId + \".apk\");\nif (!fw.isFile()) {\n    // pull matching OEM framework and run apktool if first\n}","typeGuard":null,"tryCatchPattern":"try { decoder.decode(out); } catch (FrameworkNotFoundException e) { /* install the matching OEM framework, then retry decode */ }","preventionTips":["Pre-install required OEM frameworks (apktool if) in CI images for vendor apps.","Keep framework tags consistent between install (-t) and decode (-t)."],"tags":["apktool","framework","decode","oem","missing-resource"],"backgroundTag":null,"analyzedSha":"79b63384d7d7e22917e6ea8b453272da7012515b","analyzedAt":"2026-08-14T10:43:28.812Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}