Skip to content

Fix API 37 platform directory name: android-37 to android-37.0#11072

Draft
jonathanpeppers wants to merge 2 commits intomainfrom
jonathanpeppers/fix-api37-platform-path
Draft

Fix API 37 platform directory name: android-37 to android-37.0#11072
jonathanpeppers wants to merge 2 commits intomainfrom
jonathanpeppers/fix-api37-platform-path

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

Google's SDK Manager installs API 37 to platforms/android-37.0 (matching the package name platform-37.0_r01), but our tooling was looking for platforms/android-37, causing XA5207 for customer projects.

Root Cause

CI didn't catch this because xaprepare provisions the SDK platform using the apiLevel parameter (which was 37), creating platforms/android-37 locally -- matching what the tooling expected. Customers using sdkmanager get the correct android-37.0 directory name.

Changes

  • BuildAndroidPlatforms.cs: platformID: '37' to '37.0'
  • AndroidToolchain.cs: apiLevel: '37' to '37.0'
  • Configuration.props: AndroidLatestUnstablePlatformId 37 to 37.0
  • Rename api-37.xml to api-37.0.xml and api-37.params.txt to api-37.0.params.txt
  • Update merge-configuration.xml and metadata references
  • Update CI DefaultTestSdkPlatforms variable

Google's SDK Manager installs API 37 to platforms/android-37.0 (matching
the package name platform-37.0_r01), but our tooling was looking for
platforms/android-37, causing XA5207 for customer projects.

CI didn't catch this because xaprepare provisions the SDK platform using
the apiLevel parameter (which was '37'), creating platforms/android-37
locally - matching what the tooling expected. Customers using sdkmanager
get the correct android-37.0 directory name.

Fix by changing platformID/apiLevel from '37' to '37.0' consistently:
- BuildAndroidPlatforms.cs: platformID '37' → '37.0'
- AndroidToolchain.cs: apiLevel '37' → '37.0'
- Configuration.props: AndroidLatestUnstablePlatformId '37' → '37.0'
- Rename api-37.xml → api-37.0.xml (and .params.txt)
- Update merge-configuration.xml and metadata references
- Update CI DefaultTestSdkPlatforms variable

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers
Copy link
Copy Markdown
Member Author

/azp run Xamarin.Android-PR

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

jonathanpeppers added a commit to dotnet/android-tools that referenced this pull request Apr 2, 2026
…320)

Fixes: #319

Starting with API 37, Google's SDK Manager installs platform directories as `android-37.0` instead of `android-37`. Both `TryGetPlatformDirectoryFromApiLevel` and `IsPlatformInstalled` only tried `android-{major}`, so projects targeting these newer API levels would fail with **XA5207**.

This adds a `.0` fallback to both methods: when the integer-only directory doesn't exist, also try `android-{id}.0`.

This complements the data-side fix in dotnet/android#11072 (which sets the `Id` to `"37.0"` directly) by providing a safety net when the `Id` is just `"37"`.

### Changes

- **`AndroidSdkInfo.TryGetPlatformDirectoryFromApiLevel`** — After existing lookups fail, try `GetPlatformDirectoryFromId(id + ".0")` when `id` is an integer.
- **`AndroidSdkInfo.IsPlatformInstalled`** — Apply the same `.0` fallback so it stays consistent with `TryGetPlatformDirectoryFromApiLevel`.
- **`AndroidSdkInfoTests`** — New test `TryGetPlatformDirectoryFromApiLevel_MajorFallsBackToMajorDotZero` creates only `android-37.0` and verifies both APIs find it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…back

Includes dotnet/android-tools#320 which adds a fallback in
TryGetPlatformDirectoryFromApiLevel: when android-{id} doesn't exist
and id is an integer, it also tries android-{id}.0.

This fixes XA5207 for customers whose SDK Manager installs API 37 to
platforms/android-37.0 instead of platforms/android-37.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers
Copy link
Copy Markdown
Member Author

/azp run Xamarin.Android-PR

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

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