{"record":{"id":"caeffd3bccf27f29","repo":"iBotPeaches/Apktool","slug":"library-package-not-found-id-0x-02x","errorCode":null,"errorMessage":"Library package not found: id=0x%02x","messagePattern":"Library 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":231,"sourceCode":"        } else {\n            name = mDynamicRefTable.get(id);\n            if (name == null) {\n                return null;\n            }\n        }\n\n        String[] fileNames = mConfig.getLibraryFiles().get(name);\n        if (fileNames == null) {\n            return null;\n        }\n\n        for (String fileName : fileNames) {\n            loadPackagesFromApk(new File(fileName));\n        }\n\n        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","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/iBotPeaches/Apktool/blob/79b63384d7d7e22917e6ea8b453272da7012515b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/table/ResTable.java#L213-L249","documentation":"ResTable tried to resolve a reference into a shared-library package: it looked up the library by name in the configured library files, loaded them, but no package group with the expected ID appeared in the table. The message names the package ID that stayed missing.","triggerScenarios":"An APK references resources from a shared library (package IDs assigned via dynamic reference tables, e.g. com.google.android.maps or OEM libraries) and the APK's metadata lists library files, but those files do not actually contain a package with the referenced ID.","commonSituations":"Decoding OEM/Google APKs that depend on shared resource libraries without having those libraries available; a mismatch between the library APK version the app was built against and the one supplied via Config; library paths in the config pointing to stale or wrong files.","solutions":["Supply the correct shared-library APKs via the apktool config (libraryFiles) so the referenced package ID resolves","Update apktool — shared-library/dynamic-reference handling differs between versions and newer releases resolve more layouts","Pull the exact library APKs from the same device/ROM the target app came from (paths like /system/framework/*.apk or /system_ext/framework) and register them","Verify which ID is failing (the message hex) and dump the candidate library APK (`aapt dump resources lib.apk`) to confirm it really owns that package ID"],"exampleFix":"// before\nConfig config = new Config();\n// no library files configured -> Library package not found: id=0x0b\nApkDecoder decoder = new ApkDecoder(config);\n\n// after\nConfig config = new Config();\nconfig.setLibraryFiles(Map.of(\n    \"com.example.oemlib\",\n    new String[] { \"/system/framework/com.example.oemlib.apk\" }));\nApkDecoder decoder = new ApkDecoder(config);","handlingStrategy":"try-catch","validationCode":"// Verify each configured library APK actually provides its package id\nConfig config = new Config();\nfor (Map.Entry<String, String[]> lib : config.getLibraryFiles().entrySet()) {\n    for (String f : lib.getValue()) {\n        try (ZipFile zf = new ZipFile(f)) {\n            ZipEntry arsc = zf.getEntry(\"resources.arsc\");\n            if (arsc == null) throw new IllegalStateException(\"Library APK lacks resources.arsc: \" + f);\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    ResPackageGroup g = table.getPackageGroup(id); // or full decode\n} catch (AndrolibException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Library package not found\")) {\n        // parse the id from the message, then register the matching library APK in Config and retry\n    } else { throw e; }\n}","preventionTips":["Pull shared-library APKs from the same ROM as the target app","Keep library file registrations in Config in sync with the apps you decode","Decode with the same environment consistently: bake library paths into your pipeline config"],"tags":["apktool","shared-library","package-id","resources"],"backgroundTag":null,"analyzedSha":"79b63384d7d7e22917e6ea8b453272da7012515b","analyzedAt":"2026-08-14T10:43:28.812Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}