Skip to content

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

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

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.

@jonathanpeppers jonathanpeppers marked this pull request as ready for review April 3, 2026 15:08
Copilot AI review requested due to automatic review settings April 3, 2026 15:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the repo’s “API 37 preview” identifiers from 37 to 37.0 where they’re used to form Android SDK platform directory/file names, aligning with how sdkmanager installs the platform (platforms/android-37.0) and preventing XA5207 caused by looking for platforms/android-37.

Changes:

  • Update xaprepare’s Android platform provisioning to install/use android-37.0 instead of android-37.
  • Update build configuration/CI variables to treat the latest unstable platform id as 37.0.
  • Rename/update API merge and metadata references to api-37.0.* artifacts.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Mono.Android/metadata Updates merge-source matching rules from api-37.xml.in to api-37.0.xml.in.
Configuration.props Sets AndroidLatestUnstablePlatformId default to 37.0 so generated/pipeline tooling uses the correct platform id.
build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs Provisions platform component into platforms/android-37.0 via apiLevel: "37.0".
build-tools/xaprepare/xaprepare/ConfigAndData/BuildAndroidPlatforms.cs Changes platformID for API 37 preview to 37.0 to keep generated outputs consistent.
build-tools/automation/yaml-templates/variables.yaml Updates CI-installed SDK platforms list to include 37.0.
build-tools/api-merge/merge-configuration.xml Updates merge input/output file names from api-37.* to api-37.0.*.

@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.

PureWeen added a commit to dotnet/maui that referenced this pull request Apr 3, 2026
Backport of #34805 to preview3.

## Problem

CI macOS builds fail with:

```
XA5207: Could not find android.jar for API level 36.1
Expected: /Users/builder/Library/Developer/Xamarin/android-sdk-macosx/platforms/android-36.1/android.jar
```

`AndroidTargetFrameworkVersion` was bumped to `36.1` but the
provisioning list only had `android-36`. When CI runs with
`onlyAndroidPlatformDefaultApis: true`, only the `IsDefault` item gets
installed via `dotnet android sdk install --package
"platforms;android-36.1"`.

## Fix

- Keep `android-36` in the list (without `IsDefault`)
- Add `android-36.1` with `IsDefault=True` so CI installs it
- Add `android-37` for forward-compat (without `IsDefault`)

## Related

- #34805 — net11.0 target
- dotnet/android#11072 — same class of issue for API 37
- dotnet/android#10536 — non-integer API level support fixes

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants