MuntashirAkon/AppManager · warning · Resources.NotFoundException

String resource ID ${stringRes}

Error message

String resource ID ${stringRes}

What it means

ResourceUtil.getString resolves the name via resources.getIdentifier(stringRes, "string", packageName). If the resolution returns 0 (the string does not exist in the target package's resources), it throws Resources.NotFoundException("String resource ID <stringRes>"). Resources are present and the lookup ran; only this particular key is missing. Note the message wording — it names the unresolved resource name, not a numeric ID.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/utils/ResourceUtil.java:136

        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

  1. Verify the key exists in the target package's resources (aapt dump strings) before lookup
  2. Catch Resources.NotFoundException and fall back to a default string
  3. Retry with a candidate list of alternative key names
  4. Ensure you are targeting the correct package when constructing ResourceUtil

Example fix

// before
String label = ru.getString("com.example:string_key");
// after
String label;
try {
    label = ru.getString("string_key");
} catch (Resources.NotFoundException e) {
    label = "Default Label";
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (resources.getIdentifier(key, "string", packageName) == 0) {
    // key missing in target resources; skip or fallback
}

Type guard

boolean stringKeyExists(Resources res, String key, String pkg) {
    return res.getIdentifier(key, "string", pkg) != 0;
}

Try / catch

try {
    s = resourceUtil.getString(stringRes);
} catch (Resources.NotFoundException e) {
    s = defaultValueFor(stringRes);
}

Prevention

When it happens

Trigger: Calling getString('some_key') where the target package has no string entry named some_key (typo, different locale default, resource removed in the installed version).

Common situations: Referencing AOSP/internal string names that a vendor ROM removed; version skew between the documented key and the installed app; transposed or wrong-case resource names.

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


AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12). Data as JSON: /api/errors/bffc3b342e5dcd22. Report an issue: GitHub.