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

  1. Use an official jadx release build rather than a custom/shaded jar.
  2. Rebuild jadx cleanly (./gradlew clean build) and confirm res-map.txt is packaged in jadx-core.jar.
  3. If shading, ensure the build includes resource files (not just .class).
  4. 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

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


AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14). Data as JSON: /api/errors/b5bfa7d340f9513e. Report an issue: GitHub.