iBotPeaches/Apktool · error · UndefinedResObjectException

overlayable: pkgId=0x%02x, name=%s

Error message

overlayable: pkgId=0x%02x, name=%s

What it means

UndefinedResObjectException thrown by ResPackage.getOverlayable(name) when no ResOverlayable with that name exists in the package. Overlayables are declared via <overlayable> blocks in resources.arsc (Android 10+ runtime resource overlays); requesting one that was never declared — or is declared in a different package — raises this.

Source

Thrown at brut.apktool/apktool-lib/src/main/java/brut/androlib/res/table/ResPackage.java:305

        return entry;
    }

    public int getEntryCount() {
        return mEntries.size();
    }

    public Collection<ResEntry> listEntries() {
        return mEntries.values();
    }

    public boolean hasOverlayable(String name) {
        return mOverlayables.containsKey(name);
    }

    public ResOverlayable getOverlayable(String name) throws UndefinedResObjectException {
        ResOverlayable overlayable = mOverlayables.get(name);
        if (overlayable == null) {
            throw new UndefinedResObjectException(
                String.format("overlayable: pkgId=0x%02x, name=%s", getId(), name));
        }
        return overlayable;
    }

    public ResOverlayable addOverlayable(String name, String actor) throws AndrolibException {
        ResOverlayable overlayable = mOverlayables.get(name);
        if (overlayable != null) {
            throw new AndrolibException(
                String.format("Repeated overlayable: pkgId=0x%02x, name=%s", getId(), name));
        }

        overlayable = new ResOverlayable(this, name, actor);
        mOverlayables.put(name, overlayable);
        return overlayable;
    }

    public int getOverlayableCount() {

View on GitHub (pinned to 79b63384d7)

Solutions

  1. Guard with hasOverlayable(name) before getOverlayable(name).
  2. Ensure the package you query is the one that declares the overlayable (commonly the base APK package).
  3. Keep overlayable names stable across app versions if external overlays depend on them; on failure, log the missing name to identify the stale overlay.

Example fix

// before
ResOverlayable o = pkg.getOverlayable(name);

// after
if (!pkg.hasOverlayable(name)) {
    Log.w(TAG, "overlayable not declared in pkg " + pkg.getId() + ": " + name);
    return;
}
ResOverlayable o = pkg.getOverlayable(name);
Defensive patterns

Strategy: type-guard

Type guard

boolean hasOverlayable(ResPackage pkg, String name) {
    return pkg.hasOverlayable(name);
}

Try / catch

try {
    ResOverlayable o = pkg.getOverlayable(name);
} catch (UndefinedResObjectException ex) {
    // overlayable not declared in this package; skip overlay application
}

Prevention

When it happens

Trigger: An <overlay> or policy reference naming an overlayable that this package does not declare; parsing split APKs where the overlayable lives in the base but the reference appears in a split parsed without it; typos or renamed overlayable names between app versions.

Common situations: Working with RRO (runtime resource overlay) targets; OEM/themed apps using overlayable resources; app updates that renamed overlayable blocks while external overlays kept old names.

Related errors


AI-assisted analysis of iBotPeaches/Apktool@79b63384d7 (2026-08-14). Data as JSON: /api/errors/299ea0de9237ff1e. Report an issue: GitHub.