skylot/jadx · critical · JadxRuntimeException
Failed to load android resource file (res-map.txt)
Error message
Failed to load android resource file (res-map.txt)
What it means
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.
Source
Thrown at jadx-core/src/main/java/jadx/core/utils/android/AndroidResourcesMap.java:28
/**
* Store resources id to name mapping
*/
public class AndroidResourcesMap {
private static final Map<Integer, String> RES_MAP = loadBundled();
public static @Nullable String getResName(int resId) {
return RES_MAP.get(resId);
}
public static Map<Integer, String> getMap() {
return RES_MAP;
}
private static Map<Integer, String> loadBundled() {
try (InputStream is = AndroidResourcesMap.class.getResourceAsStream("/android/res-map.txt")) {
return TextResMapFile.read(is);
} catch (Exception e) {
throw new JadxRuntimeException("Failed to load android resource file (res-map.txt)", e);
}
}
}
View on GitHub (pinned to e738a26571)
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.
Defensive patterns
Strategy: validation
Validate before calling
// Verify the bundled resource is reachable at startup, before the static init throws.
try (InputStream is = AndroidResourcesMap.class.getResourceAsStream("/android/res-map.txt")) {
if (is == null) {
throw new IllegalStateException("res-map.txt missing from jadx-core jar - rebuild/repackage");
}
} Try / catch
// Guard at init; fail with an actionable message instead of the raw wrapper.
try {
Class.forName("jadx.core.utils.android.AndroidResourcesMap"); // triggers <clinit>
} catch (ExceptionInInitializerError e) {
Throwable c = e.getCause();
if (c instanceof JadxRuntimeException && c.getMessage().contains("res-map.txt")) {
throw new IllegalStateException("jadx-core jar is incomplete - res-map.txt is missing", e);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: AndroidResourcesMap.<clinit> loads RES_MAP = loadBundled(); getResourceAsStream("/android/res-map.txt") returns null or the stream cannot be parsed by TextResMapFile.read.
Common situations: 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.
Related errors
- {} not found in classpath
- AndroidManifest.xml is missing
- Can not parse xml content
- Expected: 0x%08x, got: 0x%08x
- Failed to init res table provider: ${resTableParserProvider}
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/b5bfa7d340f9513e.
Report an issue: GitHub.