LSPosed/LSPosed · error · Resources.NotFoundException
${pkg}:${type}/${name}
Error message
${pkg}:${type}/${name} What it means
XResources.setReplacement(pkg, type, name, replacement) throws Resources.NotFoundException('<pkg>:<type>/<name>') when getIdentifier(name, type, pkg) returns 0, i.e. the module/app resource table contains no entry with that triple. The message concatenates the exact triple used for lookup, so it names precisely what was missing.
Source
Thrown at core/src/main/java/android/content/res/XResources.java:507
*
* <p><i>
* * Auto-boxing allows you to use literals like {@code 123} where an {@link Integer} is
* accepted, so you don't neeed to call methods like {@link Integer#valueOf(int)} manually.<br>
* ** Some of these methods have multiple variants, only one of them is mentioned here.
* </i>
*
* @param pkg The package name, e.g. {@code com.example.myapplication}.
* See {@link #getResourcePackageName}.
* @param type The type name, e.g. {@code string}.
* See {@link #getResourceTypeName}.
* @param name The entry name, e.g. {@code app_name}.
* See {@link #getResourceEntryName}.
* @param replacement The replacement.
*/
public void setReplacement(String pkg, String type, String name, Object replacement) {
int id = getIdentifier(name, type, pkg);
if (id == 0)
throw new NotFoundException(pkg + ":" + type + "/" + name);
setReplacement(id, replacement, this);
}
/**
* Sets a replacement for an individual Android framework resource (in the {@code android} package).
* See {@link #setSystemWideReplacement(String, String, String, Object)}.
*
* @param id The ID of the resource which should be replaced.
* @param replacement The replacement.
*/
public static void setSystemWideReplacement(int id, Object replacement) {
setReplacement(id, replacement, null);
}
/**
* Sets a replacement for an individual Android framework resource (in the {@code android} package).
* See {@link #setSystemWideReplacement(String, String, String, Object)}.
*View on GitHub (pinned to df74d83eb0)
Solutions
- Verify the identifier first: int id = res.getIdentifier(name, type, pkg); skip if id == 0.
- Dump the target app's resources (aapt2 dump resources app.apk or apktool) and correct the name/type.
- Prefer numeric resource IDs captured at build time for version-sensitive targets.
- Guard replacement setup per app version if names diverge.
Example fix
// before
res.setReplacement("com.example.app", "string", "app_name", "Modded"); // NotFoundException if absent
// after
int id = res.getIdentifier("app_name", "string", "com.example.app");
if (id != 0) res.setReplacement(id, "Modded", res); Defensive patterns
Strategy: validation
Validate before calling
int id = res.getIdentifier(name, type, pkg); if (id != 0) res.setReplacement(id, replacement, res);
Prevention
- Resolve-by-name then check id != 0 before every replacement.
- Refresh resource names against the current target APK after app updates.
When it happens
Trigger: Calling setReplacement("com.example.app", "string", "app_name", "X") when the target app has no resource named app_name of type string in that package — typo in the name, wrong package, or wrong type (e.g. 'color' vs 'drawable').
Common situations: Target app was updated and the resource was renamed/removed; hardcoding names that differ across app versions or build flavors (debug vs release); assuming a framework id exists in the app's package.
Related errors
- path must not be null
- This method can only be called during getTopLevelResources()
- id 0 is not an allowed resource identifier
- ids >= 0x7f000000 are app specific and cannot be set for the
- Could not determine package name for ${resDir}
AI-assisted analysis of LSPosed/LSPosed@df74d83eb0 (2026-08-14).
Data as JSON: /api/errors/87b7e87682b986f5.
Report an issue: GitHub.