MuntashirAkon/AppManager · error · Resources.NotFoundException
No resource could be loaded.
Error message
No resource could be loaded.
What it means
ResourceUtil.getString resolves a string resource by name through the wrapped Resources instance. If the ResourceUtil was constructed without usable Resources (the internal resources field is null), it throws Resources.NotFoundException("No resource could be loaded.") before attempting identifier lookup. This signals that no target package/context resources are available at all, as opposed to a missing individual key.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/utils/ResourceUtil.java:133
public boolean loadAndroidResources() {
this.packageName = "android";
this.className = null;
this.resources = Resources.getSystem();
return true;
}
/**
* Return the string value associated with a particular resource ID. It will be stripped of any styled text information.
*
* @param stringRes The desired resource identifier.
* @return String The string data associated with the resource, stripped of styled text information.
* @throws Resources.NotFoundException Throws NotFoundException if the given ID does not exist.
*/
@NonNull
@SuppressLint("DiscouragedApi")
public String getString(@NonNull String stringRes) throws Resources.NotFoundException {
if (resources == null) {
throw new Resources.NotFoundException("No resource could be loaded.");
}
int intStringRes = resources.getIdentifier(stringRes, "string", packageName);
if (intStringRes == 0) throw new Resources.NotFoundException("String resource ID " + stringRes);
return this.resources.getString(intStringRes);
}
}
View on GitHub (pinned to 0152f468fc)
Solutions
- Ensure the manifest declares <queries> entries for the target packages (Android 11+ package visibility)
- Verify the target package is installed (pm.getPackageInfo) before constructing ResourceUtil
- Check the construction path that sets resources; use a valid Context's getResources()
- Catch Resources.NotFoundException and fall back to a local string
Example fix
// before
String s = resourceUtil.getString("app_name");
// after
String s;
try {
s = resourceUtil.getString("app_name");
} catch (Resources.NotFoundException e) {
s = context.getString(R.string.app_name); // local fallback
} Defensive patterns
Strategy: fallback
Validate before calling
try {
pm.getPackageInfo(targetPackage, 0);
} catch (PackageManager.NameNotFoundException e) {
// target package unavailable; use local resources
} Type guard
boolean canLoadResources(PackageManager pm, String pkg) {
try { pm.getPackageInfo(pkg, 0); return true; } catch (PackageManager.NameNotFoundException e) { return false; }
} Try / catch
try {
s = resourceUtil.getString(key);
} catch (Resources.NotFoundException e) {
s = context.getString(R.string.fallback);
} Prevention
- Declare <queries> for target packages to survive Android 11+ package visibility filtering
- Verify package installation before constructing ResourceUtil
- Always keep a local default for every external string you look up
When it happens
Trigger: Constructing ResourceUtil (e.g. forApp/forPackage variants) with a null Resources instance — package not installed, not visible due to package-visibility filtering (Android 11+ <queries>), or a failed context creation — then calling getString.
Common situations: Looking up strings from another app without the Android 11 package-visibility declaration in the manifest; querying an uninstalled package; passing a null package name/context during construction.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Could not create cache. Is this OS broken?
- External directory unavailable.
- Resource ${resName} is not found.
- Resource ${name} of type ${type} is not found in package ${p
- String resource ID ${stringRes}
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/1945122e2d740bf9.
Report an issue: GitHub.