skylot/jadx · error · FileNotFoundException
Resource not found: {}
Error message
Resource not found: {} What it means
Thrown as FileNotFoundException by TemplateFile.fromResources() when Class.getResourceAsStream(path) returns null, meaning no resource exists at the given path on the classpath. TemplateFile is a lightweight template engine that loads .tmpl files from the jadx-core JAR's resources. A null stream indicates the template file is missing from the distribution or the path is wrong.
Source
Thrown at jadx-core/src/main/java/jadx/core/export/TemplateFile.java:46
NONE, START, VARIABLE, END
}
private static class ParserState {
private State state = State.NONE;
private StringBuilder curVariable;
private boolean skip;
}
private final String templateName;
private final InputStream template;
private final Map<String, String> values = new HashMap<>();
private @Nullable Function<String, String> valueSanitizer;
public static TemplateFile fromResources(String path) throws FileNotFoundException {
InputStream res = TemplateFile.class.getResourceAsStream(path);
if (res == null) {
throw new FileNotFoundException("Resource not found: " + path);
}
return new TemplateFile(path, res);
}
private TemplateFile(String name, InputStream in) {
this.templateName = name;
this.template = in;
}
public void add(String name, @Nullable Object value) {
values.put(name, String.valueOf(value));
}
public String build() throws IOException {
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
process(out);
return out.toString();
}View on GitHub (pinned to e738a26571)
Solutions
- Verify the template resource exists inside the jadx-core JAR (unzip and check under /export/).
- Ensure the path starts with '/' and matches the exact resource path (case-sensitive).
- Re-download or rebuild jadx from source to get a complete distribution.
- If developing custom export code, confirm the template path matches an actual resource file in src/main/resources.
Defensive patterns
Strategy: validation
Validate before calling
// Verify the resource exists before creating a TemplateFile
if (TemplateFile.class.getResource(path) == null) {
throw new FileNotFoundException("Template resource not on classpath: " + path);
}
TemplateFile tmpl = TemplateFile.fromResources(path); Try / catch
try {
TemplateFile tmpl = TemplateFile.fromResources(path);
} catch (FileNotFoundException e) {
LOG.error("Template resource missing: {}. Ensure jadx-core JAR is complete.", path);
return;
} Prevention
- Verify template resources are packaged in the jadx-core JAR under /export/.
- Ensure paths start with '/' and match exact resource paths (case-sensitive).
- Use a complete, unmodified jadx distribution.
- If building jadx from source, confirm resources are included in the build (check build.gradle.kts resource configuration).
When it happens
Trigger: TemplateFile.fromResources(path) is called with a path that does not match any bundled resource. Paths are absolute (must start with '/'), e.g. '/export/java/settings.gradle.kts.tmpl'. This is called by the Gradle generators during export, and potentially by other template consumers.
Common situations: Using an incomplete or corrupted jadx build where template resources were stripped from the JAR (e.g. by an aggressive shading/proguard step). Passing a wrong template path from custom code. Resource path case-sensitivity issues on case-sensitive filesystems.
Related errors
- Failed to generate gradle files
- Template already processed
- Expected variable end: '{}' (missing second '}')
- Unknown variable: '{}' in template: {}
- {} not found in classpath
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/593352a74be67a1d.
Report an issue: GitHub.