[Ubuntu][Windows] Update Android command-line tools to 22.0 - #14676
Open
matanbaruch wants to merge 2 commits into
Open
matanbaruch wants to merge 2 commits into
matanbaruch wants to merge 2 commits into
Conversation
cmdline-tools below 20.0 cannot parse Major.Minor package paths:
AndroidTargetHash.getPlatformVersion("android-37.0") returns null, so
avdmanager silently writes target=android-0 into the AVD .ini and the
emulator skips its Vulkan/GLDirectMem auto-enable. Revision 22.0 parses
those paths and also ships the Android CLI (bin/android), the announced
replacement for sdkmanager.
Images that default to Java 11 or older (ubuntu-22.04, windows-2022) keep
their current revision: 22.0 is compiled for Java 17.
Refs actions#14484
Two defects kept the "latest" toolset value from ever resolving: - the branch tested $cmdline_tools_version, which is never assigned; the value is read into $cmdline_tools_package, so "latest" fell through and was used as a file name - the yq query addressed .sdk-repository, but repository2-1.xml declares the namespaced root sdk:sdk-repository, so the query returned nothing
matanbaruch
force-pushed
the
update-android-cmdline-tools-22
branch
from
September 2, 2026 20:34
fcbdde0 to
cf7558a
Compare
Author
|
@v-AndriiKhyliuk @v-SergeiRadich @v-sergei-pyshnoi mind taking a look? Ready for review and scoped to the Java 17 images only (ubuntu-24.04/26.04, windows-2025), ubuntu-22.04 and windows-2022 stay on 12.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #14484 for the Ubuntu and Windows images: updates the preinstalled Android SDK Command-line Tools to 22.0 (build
15859902).Why
cmdline-toolsolder than 20.0 cannot parse theMajor.Minorpackage paths Android now publishes (android-37.0,system-images;android-37.0;google_apis_ps16k;x86_64). I confirmed the root cause directly against thesdklibshipped in each revision:AndroidTargetHash.getPlatformVersion("android-37.0")target=written into the AVD.iniubuntu-24.04)nullandroid-0❌API 37.0android-37.0✅avdmanager create avdstill exits 0, so the AVD looks fine but recordstarget=android-0. The emulator then treats it as a very old system image, skips the Vulkan / GLDirectMem auto-enable and renders blank or corrupted frames while every step of the workflow reports success — nothing points back at the SDK tools.22.0 is also the first revision that ships the Android CLI (
cmdline-tools/latest/bin/android,android.exeon Windows) — the replacement thatsdkmanagernow advertises on every invocation. One version bump therefore covers both requests in the issue, with no new tool to package.Images updated
ubuntu-24.04ubuntu-26.04windows-2025windows-2025(VS2026)The arm64 Ubuntu toolsets are kept in sync with their x64 counterparts, as they are today (no arm64 template runs
install-android-sdk.sh).Left on the current revision on purpose
ubuntu-22.04(9.0) andwindows-2022(8.0). cmdline-tools 22.0 is compiled for Java 17 — class file version 61, against 55 in 12.0/20.0 and 52 in 8.0/9.0 — and those two images default to Java 11 and Java 8 respectively. Bumping them would breaksdkmanagerfor every workflow that uses the image's default JDK, and the image build itself, which runssdkmanagerunder that default. Glad to add them if you would prefer to pin the Android install step toJAVA_HOME_17_X64instead.macOS is untouched, per CONTRIBUTING. The same one-line change applies to
toolset-14/15/26/xcode-27.json, with one caveat worth recording: starting with 22.0 Google renamed the macOS archive, so the value becomescommandlinetools-mac_x86_64-15859902_latest.zip(thecontains("commandlinetools-mac")filter ininstall-android-sdk.shstill matches it).Compatibility with the existing scripts
22.0 keeps the classic
sdkmanager— a Java tool with the pipe-table--listoutput — so nothing in this repo needs to change. Verified against real 22.0 output:sed -n '/Available Packages:/,/^$/p' | grep "platforms;android-[0-9]" | cut -d"|" -f 1and thebuild-tools;/ndk;<major>.greps ininstall-android-sdk.shstill return the expected package pathssdkmanager --versionprints exactly22.0on stdout; the new deprecation notice goes to stderr, soGet-AndroidCommandLineToolsVersionin the software report keeps matchingGet-AndroidPackagespicks up through2>&1are dropped by its existing-NotMatch "^[^;]*$"filter, since none of them contains a;sdkmanagerbecomes a shell shim overandroid sdk,--listswitches tobuild-tools/17.0.0-style paths with no|columns, and--include_obsolete/--verboseare accepted-but-ignored. That silently breaks the platform/build-tools/NDK selection ininstall-android-sdk.sh,Get-AndroidPackageson Windows and the software report parsing. That is why this PR pins 22.0 explicitly rather than switching the pin tolatest.Second commit:
latestresolution on Ubuntuinstall-android-sdk.shsupports"cmdline-tools": "latest", but two defects meant it could never work:$cmdline_tools_version, which is never assigned — the toolset value is read into$cmdline_tools_package, solatestfell straight through and was used as a file nameyqquery addresses.sdk-repository, whilerepository2-1.xmldeclares the namespaced rootsdk:sdk-repository, so the query returns nothing and the script exits with "Failed to parse latest command-line tools version"With both fixed, the query resolves against the current repository index:
The pins stay explicit; this only makes the documented
latestoption usable (and it now fails loudly rather than downloading a file calledlatest).The macOS script carries a byte-identical copy of that block (
images/macos/scripts/build/install-android-sdk.sh, differing only incommandlinetools-mac), with the same.sdk-repositoryroot, so it needs the same one-line change. Left out of this PR per CONTRIBUTING, along with the toolset bump.Validation
A
Command-line toolscontext inimages/ubuntu/scripts/tests/Android.Tests.ps1andimages/windows/scripts/tests/Android.Tests.ps1asserts that theandroidCLI is present, and is skipped on the images that stay on the older revision. That single check also covers the revision, sinceandroidonly ships from 22.0 on.What I checked locally against the 22.0 package (macOS host with JDK 25 —
sdkmanageris the same Java tool on every platform):AndroidTargetHash.getPlatformVersion("android-37.0")against thesdklibof each revision gives the table above (nullon 12.0,API 37.0/android-37.0on 22.0)repository2-1.xml, and the Windows SHA-256 added to the toolsets is computed from that verified download--listparsing checks listed under Compatibility were run against real 22.0 outputI cannot build a full runner image here, so the end-to-end AVD check from the issue is unverified on my side. The issue reports
target=android-37.0from 20.0 onward, which is consistent with the parser results above.I did not add the Android CLI to the software report:
androidself-updates from Google on first run, so its version is a property of when it is invoked rather than of the image. Happy to add a row if you would like it reported anyway.