iBotPeaches/Apktool · error · FrameworkNotFoundException

Could not find framework resources for package ID {pkgId}. Y

Error message

Could not find framework resources for package ID {pkgId}.
You must install proper framework files, see project website for more info.

What it means

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.

Source

Thrown at brut.apktool/apktool-lib/src/main/java/brut/androlib/res/Framework.java:192

        }

        // Fall back to the untagged framework.
        apkFile = new File(dir, id + getApkSuffix(null));
        if (apkFile.exists()) {
            return apkFile;
        }

        // If the default framework is requested but is missing, extract the built-in one.
        if (id == 1) {
            try {
                BrutIO.copyAndClose(getAndroidFrameworkAsStream(), Files.newOutputStream(apkFile.toPath()));
            } catch (IOException ex) {
                throw new AndrolibException(ex);
            }
            return apkFile;
        }

        throw new FrameworkNotFoundException(id);
    }

    private String getApkSuffix() {
        return getApkSuffix(mConfig.getFrameworkTag());
    }

    private static String getApkSuffix(String tag) {
        return ((tag != null && !tag.isEmpty()) ? "-" + tag : "") + ".apk";
    }

    private InputStream getAndroidFrameworkAsStream() {
        return getClass().getResourceAsStream("/prebuilt/android-framework.jar");
    }

    public void cleanDirectory() throws AndrolibException {
        for (File apkFile : listDirectory()) {
            Log.i(TAG, "Removing framework file: " + apkFile.getName());
            OS.rmfile(apkFile);

View on GitHub (pinned to 79b63384d7)

Solutions

  1. 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>`.
  2. If the framework was installed under a tag, decode with the same tag: `apktool d -t <tag> app.apk`.
  3. Confirm the installed file name matches <pkgId>.apk in the framework dir (ls the --frame-path).

Example fix

# before
apktool d com.htc.app.apk        # needs HTC framework (id 15)
# after
adb pull /system/framework/com.htc.resources.apk .
apktool if com.htc.resources.apk
apktool d com.htc.app.apk
Defensive patterns

Strategy: try-catch

Validate before calling

int pkgId = 2; // from the app's resources.arsc
File fw = new File(frameworkDir, pkgId + ".apk");
if (!fw.isFile()) {
    // pull matching OEM framework and run apktool if first
}

Try / catch

try { decoder.decode(out); } catch (FrameworkNotFoundException e) { /* install the matching OEM framework, then retry decode */ }

Prevention

When it happens

Trigger: 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`).

Common situations: 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.

Related errors


AI-assisted analysis of iBotPeaches/Apktool@79b63384d7 (2026-08-14). Data as JSON: /api/errors/8b2b05bb6e8904d0. Report an issue: GitHub.