Skip to content

Add Android 17 (build-tools 37.0.0) support#1

Merged
Jawnnypoo merged 5 commits into
mainfrom
android-17-support
Jun 18, 2026
Merged

Add Android 17 (build-tools 37.0.0) support#1
Jawnnypoo merged 5 commits into
mainfrom
android-17-support

Conversation

@Jawnnypoo

Copy link
Copy Markdown
Member

What

Gets the upstream-watch pipeline building the linux-arm64 build-tools against Android 17 (android-17.0.0_r1, sdkmanager build-tools;37.0.0). The nightly watcher already detected 37.0.0 but the build failed on three Android-17 source changes; this gets it green.

Build fixes

Android 17 bumped protobuf to 33.5.0 and reworked some androidfw internals. With ninja -k 0 surfacing everything in one pass, three root causes:

  1. 983cf1f protobuf utf8_range include — protobuf 33.5.0's parse_context.h (reached from every generated *.pb.h) includes utf8_validity.h, which lives in protobuf's vendored third_party/utf8_range/. libaapt2 hand-compiles the .pb.cc files without linking protobuf, so it needs that dir on its include path explicitly — same pattern as the existing abseil workaround just above it.
  2. eb730eb androidfw <variant> include — Android 17 made android::Asset back its buffer with a std::variant, but Asset.h never #include <variant>. bionic/libc++ pulls it in transitively; glibc + libstdc++ 12 doesn't, so the header fails and cascades into libandroidfw/libaapt/aapt2. New patch.
  3. e44d59d new aconfig flagAssetsProvider.cpp references android_content_res_xml_file_size_limit(), a new content-res flag absent from our aconfig stub. Force-disabled like the rest, keeping the legacy path.

Plumbing

  1. 0421d29 version mapping — promote build-tools 37.0.0 → android-17.0.0_r1 from the heuristic to a verified KNOWN_MAPPINGS entry; drop the now-false "android-17 isn't tagged yet" note + docstring example.
  2. 75654a7 optional patches — protobuf 33.5.0 dropped the config/ dir, so protobuf-include-config.patch (needed only through ~25.x / Android 16) no longer applies and was noisily flagged STALE on every 17 build. Add an # Optional: patch header so expected-not-applicable patches skip quietly, and mark that patch optional. Android 16 still gets it applied normally.

Validation

  • Local arm64 (Raspberry Pi 5, Debian Bookworm / g++ 12.2 — matches docker/linux-arm64.Dockerfile): full build of all four tools green; each is a valid aarch64 glibc ELF and runs (aapt2 version, aidl --help, zipalign, split-select --help).
  • CI dry-run 27732685915: detect + build green (26m), artifact linux-arm64-platform-tools-37.0.0 uploaded, release correctly skipped. Build validated at e44d59d; commits 4–5 are detection/log-only and were validated locally (resolver unit call) and on the Pi (apply_patches run). A fresh dry-run on the branch HEAD is running as the final check.

Once merged, the nightly upstream-watch will build & publish platform-tools-37.0.0 (linux-arm64) automatically.

🤖 Generated with Claude Code

Jawnnypoo and others added 5 commits June 17, 2026 18:52
Android 17's bundled protobuf makes parse_context.h (a public header
reached from every generated *.pb.h) include "utf8_validity.h", which
lives in protobuf's vendored utf8_range copy rather than under src/.
libaapt2 hand-compiles the generated .pb.cc files without linking
protobuf, so it doesn't inherit protobuf's include dirs — same
propagation gap already worked around for abseil just above. Add the
utf8_range source dir directly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Android 17 reworked android::Asset to back its buffer with
  using Data = std::variant<base::MappedFile, ...>;
but Asset.h doesn't include <variant>. AOSP's bionic/libc++ build pulls
it in transitively; under glibc + libstdc++ 12 it doesn't, so the
header fails with "'variant' in namespace 'std' does not name a
template type", cascading into every TU that includes Asset.h
(libandroidfw, libaapt, aapt2's SymbolTable). Add the missing include.

Verified: full linux-arm64 build of aapt2/aidl/zipalign/split-select
goes green against android-17.0.0_r1 and the binaries run on arm64.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Android 17 adds a new content-res feature flag that AssetsProvider.cpp
references (xml_file_size_limit()). Our aconfig stub didn't define it,
so the build failed with "not declared in this scope". Force-disabled
like every other flag in the stub, keeping the legacy code path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
AOSP has now tagged android-17.0.0_r1 and a full linux-arm64 build of
all four tools succeeds against it (verified on arm64 hardware + CI),
so promote the (37,0,0) resolution from the heuristic to an explicit,
verified KNOWN_MAPPINGS entry. Drop the stale note claiming android-17
isn't tagged yet, and the docstring's now-wrong "37.0.0 is no-source"
example.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A patch can carry an `# Optional: true` header, meaning it's expected
to apply only to some source revisions. When such a patch doesn't
apply, fetch_sources now skips it quietly instead of printing the
"STALE / refresh the patch" warning meant for genuinely-broken patches.

Mark protobuf-include-config.patch Optional: it fixes a missing
config.h include path that only exists through protobuf ~25.x
(Android 16). Android 17 ships protobuf 33.5.0, which dropped the
generated config.h / config dir entirely, so the patch correctly no
longer applies and was noisily flagged STALE on every 17 build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Jawnnypoo Jawnnypoo merged commit de63f3c into main Jun 18, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant