Skip to content

Modern APKs (e.g. Instagram) fail aapt2 link: missing Apktool PR #3130–class patch in release prebuilts #34

Description

@anirudhmalik

Summary

The v1.1.0 (and recipe) aapt2 builds shipped from this repo fail on modern Play-Store-style APKs during link/compile when resources use patterns that stock AOSP aapt2 rejects but Apktool’s patched tree accepts. A concrete fix exists upstream as iBotPeaches/Apktool#3130unrestrict value format for <item> tags (ResourceParser.cpp).

Without that patch, builds can fail with errors like:

error: invalid value for type 'layout'. Expected a reference.

Instagram (and similar large apps) often trigger this because they use <item type="layout" format="…"> (non-reference) layouts that the stricter code path rejects.

What we tried

  • Building/running against ReVanced/aapt2 releases and the pinned submodule + patch stack without a PR #3130–equivalent patch applied after apktool_ibotpeaches.patch.

Related upstream change

  • PR #3130 on iBotPeaches/Apktool (author: Igor Eisberg), re-rooted for AOSP tools/aapt2 paths.
  • apktool_ibotpeaches.patch in this repo (and the v1.1.0 release line) does not include that hunk yet, so “latest ReVanced aapt2” alone is not enough for some current APKs.

Community reference implementation

We maintain anirudhmalik/apktool-android — an Android AAR with statically linked libaapt2.so per ABI that runs Apktool in-process. The self-build flow vendors this repo’s CMake recipe under aapt2-build/recipe/ and layers 0002-aapt2-unrestrict-item-tag-value-format.patch (PR #3130) on top of the existing ReVanced patch set.

Docs / patch for review

Suggestion for ReVanced/aapt2

  1. Absorb PR #3130 (or equivalent) into patches/ and apply it after apktool_ibotpeaches.patch in patch.sh, or
  2. Wait / track until iBotPeaches’s apktool_ibotpeaches.patch export already contains that logic, then drop any duplicate.

Either path would align ReVanced/aapt2 prebuilts with what Apktool 3.x users need for current store APKs.

Optional repro

  • App: Instagram (exact version can be added when reproducing).
  • Stage: aapt2 link (not necessarily decode-only).

I’m happy to help validate a PR with a minimal failing resources.xml snippet if maintainers prefer not to attach a full APK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions