{"record":{"id":"b5bfa7d340f9513e","repo":"skylot/jadx","slug":"failed-to-load-android-resource-file-res-map-txt","errorCode":null,"errorMessage":"Failed to load android resource file (res-map.txt)","messagePattern":"Failed to load android resource file \\(res-map\\.txt\\)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"critical","filePath":"jadx-core/src/main/java/jadx/core/utils/android/AndroidResourcesMap.java","lineNumber":28,"sourceCode":"/**\n * Store resources id to name mapping\n */\npublic class AndroidResourcesMap {\n\tprivate static final Map<Integer, String> RES_MAP = loadBundled();\n\n\tpublic static @Nullable String getResName(int resId) {\n\t\treturn RES_MAP.get(resId);\n\t}\n\n\tpublic static Map<Integer, String> getMap() {\n\t\treturn RES_MAP;\n\t}\n\n\tprivate static Map<Integer, String> loadBundled() {\n\t\ttry (InputStream is = AndroidResourcesMap.class.getResourceAsStream(\"/android/res-map.txt\")) {\n\t\t\treturn TextResMapFile.read(is);\n\t\t} catch (Exception e) {\n\t\t\tthrow new JadxRuntimeException(\"Failed to load android resource file (res-map.txt)\", e);\n\t\t}\n\t}\n}\n","sourceCodeStart":10,"sourceCodeEnd":32,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/utils/android/AndroidResourcesMap.java#L10-L32","documentation":"AndroidResourcesMap.loadBundled() reads the bundled /android/res-map.txt classpath resource via TextResMapFile.read(is) and wraps any failure. res-map.txt maps Android resource IDs to names and ships inside the jadx-core jar. A failure means this resource could not be located or parsed - almost always a broken/custom jadx build or a classpath/uber-jar shading problem, not an input-file issue.","triggerScenarios":"AndroidResourcesMap.<clinit> loads RES_MAP = loadBundled(); getResourceAsStream(\"/android/res-map.txt\") returns null or the stream cannot be parsed by TextResMapFile.read.","commonSituations":"Running a partially-built or corrupt jadx jar that omits res-map.txt; a shading/fat-jar config that failed to include classpath resources; a custom classloader that does not expose package resources; filesystem/jar corruption.","solutions":["Use an official jadx release build rather than a custom/shaded jar.","Rebuild jadx cleanly (./gradlew clean build) and confirm res-map.txt is packaged in jadx-core.jar.","If shading, ensure the build includes resource files (not just .class).","Verify the classloader exposes getResourceAsStream for packaged resources."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the bundled resource is reachable at startup, before the static init throws.\ntry (InputStream is = AndroidResourcesMap.class.getResourceAsStream(\"/android/res-map.txt\")) {\n    if (is == null) {\n        throw new IllegalStateException(\"res-map.txt missing from jadx-core jar - rebuild/repackage\");\n    }\n}","typeGuard":null,"tryCatchPattern":"// Guard at init; fail with an actionable message instead of the raw wrapper.\ntry {\n    Class.forName(\"jadx.core.utils.android.AndroidResourcesMap\"); // triggers <clinit>\n} catch (ExceptionInInitializerError e) {\n    Throwable c = e.getCause();\n    if (c instanceof JadxRuntimeException && c.getMessage().contains(\"res-map.txt\")) {\n        throw new IllegalStateException(\"jadx-core jar is incomplete - res-map.txt is missing\", e);\n    }\n    throw e;\n}","preventionTips":["Use official jadx builds; avoid hand-rolled shaded jars that drop resources.","When shading, configure the plugin to include non-class resources.","Run a smoke test that touches AndroidResourcesMap at deploy time.","Keep jadx-core jar intact and uncorrupted."],"tags":["jadx","android","resources","packaging","build"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}