镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/skills/update-androidsdk-packages/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ do not update it unattended; report the ambiguity instead.
**5. Command-line tools are a coordinated product dependency.** Do not update only the bootstrap
pins. A command-line-tools bump must also update
`src/Xamarin.Installer.Build.Tasks/Xamarin.Installer.Common.props` and the matching latest entry in
`src/Xamarin.Installer.AndroidSDK/Feeds/AndroidManifestFeed_d18.0.xml`, including every published
`tools/workload-dependencies/AndroidManifestFeed_d18.0.xml`, including every published
host/architecture archive. Confirm `CodeGenerator.targets` tracks the property file that supplies
`AndroidCommandLineToolsVersion`. If the automated workflow is not authorized to change every
required file, stop and report the coordinated update instead of opening a partial PR.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ drift as the skill is used.
|---|---|---|---|---|
| build-tools | `build-tools` | `XABuildToolsVersion`, `XABuildToolsFolder` | `XABuildToolsHashMacOS/Linux/Windows` | `build-tools_r$(XABuildToolsVersion)_{macosx,linux,windows}.zip` |
| platform-tools | `platform-tools` | `XAPlatformToolsVersion` | `XAPlatformToolsHashMacOS/Linux/Windows` | `platform-tools_r$(XAPlatformToolsVersion)-{darwin,linux,win}.zip` |
| cmdline-tools | `cmdline-tools` | `CommandLineToolsFolder`, `CommandLineToolsVersion`; shipped `AndroidCommandLineToolsVersion` in `src/Xamarin.Installer.Build.Tasks/Xamarin.Installer.Common.props` | `XACmdlineToolsHashMacOS`, `XACmdlineToolsHashMacOSArm64`, `XACmdlineToolsHashLinux/Windows` | `commandlinetools-{mac_x86_64,mac_arm64,linux,win}-$(CommandLineToolsVersion).zip`; also update the latest entry in `src/Xamarin.Installer.AndroidSDK/Feeds/AndroidManifestFeed_d18.0.xml` |
| cmdline-tools | `cmdline-tools` | `CommandLineToolsFolder`, `CommandLineToolsVersion`; shipped `AndroidCommandLineToolsVersion` in `src/Xamarin.Installer.Build.Tasks/Xamarin.Installer.Common.props` | `XACmdlineToolsHashMacOS`, `XACmdlineToolsHashMacOSArm64`, `XACmdlineToolsHashLinux/Windows` | `commandlinetools-{mac_x86_64,mac_arm64,linux,win}-$(CommandLineToolsVersion).zip`; also update the latest entry in `tools/workload-dependencies/AndroidManifestFeed_d18.0.xml` |
| cmake | `cmake;` | `AndroidCmakeVersion` | `XACmakeHashMacOS/Linux/Windows` | `cmake-$(AndroidCmakeVersion)-{darwin,linux,windows}.zip` |
| emulator | `emulator` | `EmulatorVersion`, `EmulatorPkgRevision` | `XAEmulatorHashMacOSx64`, `XAEmulatorHashMacOSArm64`, `XAEmulatorHashLinux/Windows` | `emulator-{darwin_x64,darwin_aarch64,linux_x64,windows_x64}-$(EmulatorVersion).zip`; also drives a synthesized `package.xml` via `package.xml.in` |
| API 29 system image | `sys-img/android` manifest, `path="system-images;android-29;default;{x86_64,arm64-v8a}"` | (fixed `x86_64-29_r08*`/`arm64-v8a-29_r08` filenames — check manifest for a newer `rNN` if refreshing) | `XASystemImageHashMacOSx64/MacOSArm64/Linux/Windows` | `{x86_64,arm64-v8a}-29_r08{-darwin,-linux,-windows,}.zip` under `sys-img/android/` |
Expand Down
2 changes: 0 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@
<_AllowProjectWarnings Condition=" '$(MSBuildProjectFile)' == 'NativeAOT.csproj' ">true</_AllowProjectWarnings>
<_AllowProjectWarnings Condition=" '$(MSBuildProjectFile)' == 'TestRunner.Core.NET.csproj' ">true</_AllowProjectWarnings>
<_AllowProjectWarnings Condition=" '$(MSBuildProjectFile)' == 'Xamarin.Android.JcwGen-Tests.csproj' ">true</_AllowProjectWarnings>
<_AllowProjectWarnings Condition=" '$(MSBuildProjectFile)' == 'Xamarin.Installer.AndroidSDK.csproj' ">true</_AllowProjectWarnings>
<_AllowProjectWarnings Condition=" '$(MSBuildProjectFile)' == 'Xamarin.Installer.Common.csproj' ">true</_AllowProjectWarnings>
<TreatWarningsAsErrors Condition=" ('$(RunningOnCI)' == 'true' OR '$(_AndroidTreatWarningsAsErrors)' == 'true') AND '$(_AllowProjectWarnings)' != 'true' ">true</TreatWarningsAsErrors>
</PropertyGroup>

Expand Down
6 changes: 6 additions & 0 deletions Documentation/docs-mobile/TOC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,12 @@
href: messages/xa5302.md
- name: XA5305
href: messages/xa5305.md
- name: XA5306
href: messages/xa5306.md
- name: XA5307
href: messages/xa5307.md
- name: XA5308
href: messages/xa5308.md
- name: "XA6xxx: Internal tools"
href: "messages/index.md#xa6xxx-internal-tools"
- name: "XAccc7xxx: Unhandled MSBuild exceptions"
Expand Down
30 changes: 6 additions & 24 deletions Documentation/docs-mobile/building-apps/build-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -944,33 +944,15 @@ If you want detailed output from the tool you can add the following to the

## AndroidManifestType

An enum-style property with valid values of `Xamarin` or `GoogleV2`.
This controls which repository is used by the
[`InstallAndroidDependencies`](build-targets.md#installandroiddependencies)
target to determine which Android packages and package versions are
available and can be installed.

`Xamarin` is the **Approved List (Recommended)** repository within the
[Visual Studio SDK Manager](/xamarin/android/get-started/installation/android-sdk?tabs=windows#repository-selection).

`GoogleV2` is the **Full List (Unsupported)** repository within the
[Visual Studio SDK Manager](/xamarin/android/get-started/installation/android-sdk?tabs=windows#repository-selection).

If `$(AndroidManifestType)` is not set, then `Xamarin` is used.
This property was removed in .NET 12 and has no effect.
The [`InstallAndroidDependencies`](build-targets.md#installandroiddependencies)
target now uses the Android CLI to install Android SDK packages.

## AndroidManifestSource

A string property that specifies an absolute URI or an existing local file path
for the repository manifest used by the
[`InstallAndroidDependencies`](build-targets.md#installandroiddependencies)
target. When this property is not set, the default repository manifest selected
by `$(AndroidManifestType)` is used.

For example:

```xml
<AndroidManifestSource>https://example.com/AndroidManifestFeed.xml</AndroidManifestSource>
```
This property was removed in .NET 12 and has no effect.
The [`InstallAndroidDependencies`](build-targets.md#installandroiddependencies)
target now uses the Android CLI to install Android SDK packages.

## AndroidManifestPlaceholders

Expand Down
28 changes: 22 additions & 6 deletions Documentation/docs-mobile/building-apps/build-targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,19 @@ MSBuild /t:Install ProjectName.csproj /p:AdbTarget=-e
Calls the [`GetAndroidDependencies`](#getandroiddependencies) target, then installs
the Android SDK packages specified in the `@(AndroidDependency)` item group.

The Android SDK packages are installed with Google's
[Android CLI](https://developer.android.com/tools/agents/android-cli)
(`android sdk install`). The target downloads a pinned version of the Android CLI
from Google into a per-user cache. Before it runs the Android CLI, the target
makes sure that the SHA-256 hash of the file is the same as the hash included with
the .NET for Android SDK. The Android CLI is available for Windows x64, macOS (x64
and Arm64), and Linux (x64 and Arm64).

The Android CLI accepts the Android SDK licenses without a prompt. Thus, if Android SDK
packages must be installed, this target fails unless you set `$(AcceptAndroidSDKLicenses)`
to `true`. Before you set this
property, read the [Android SDK License Agreement](https://developer.android.com/studio/terms).

Before it extracts a downloaded Microsoft OpenJDK archive, this target verifies
the archive's detached digital signature. The signing key must match the trusted
key hash included with the .NET for Android SDK. Missing or invalid signatures
Expand All @@ -173,13 +186,16 @@ you will get the following error:
error MSB4057: The target "InstallAndroidDependencies" does not exist in the project.
```

The `AndroidSdkDirectory` and `JavaSdkDirectory` properties are required as we need to know where to install the required components. These directories can be empty or existing. Sdk components
will be installed on top on an existing sdk installation.
The `AndroidSdkDirectory` and `JavaSdkDirectory` properties set where the components are installed.
These directories can be empty or existing. Sdk components will be installed on top of an existing sdk installation.
If a property is not set, the build looks for an existing installation, the same as a normal build.
If it finds no installation, `AndroidSdkDirectory` uses the `ANDROID_HOME` or `ANDROID_SDK_ROOT` environment variable.
If those are also not set, the default is `%LOCALAPPDATA%\Android\Sdk` on Windows, `~/Library/Android/sdk` on macOS,
and `~/Android/Sdk` on Linux.
`JavaSdkDirectory` uses the `JAVA_HOME` or `JDK_HOME` environment variable.
If those are also not set, the default is `%LOCALAPPDATA%\Android\jdk-<major version>` on Windows and
`~/Library/Android/microsoft-<major version>.jdk` on macOS. On Linux, you must set `JavaSdkDirectory` or `JAVA_HOME`.

The [`$(AndroidManifestType)`](build-properties.md#androidmanifesttype)
MSBuild property controls which
[Visual Studio SDK Manager repository](/xamarin/android/get-started/installation/android-sdk?tabs=windows#repository-selection)
is used for package name and package version detection, and URLs to download.

## Publish

Expand Down
3 changes: 3 additions & 0 deletions Documentation/docs-mobile/messages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ Either change the value in the AndroidManifest.xml to match the $(SupportedOSPla
+ [XA5303](xa5303.md): Failed to parse 'DescriptorIndex' metadata value '{value}' for assembly '{assembly}'.
+ [XA5304](xa5304.md): Invalid AssemblyStore compression level '{level}'. The value must be between {min} and {max}.
+ [XA5305](xa5305.md): Could not verify the Microsoft OpenJDK archive signature.
+ [XA5306](xa5306.md): The Android CLI is not available for this operating system and architecture.
+ [XA5307](xa5307.md): The SHA-256 hash of the downloaded Android CLI is not correct.
+ [XA5308](xa5308.md): The Android CLI failed while it installed Android SDK packages.

## XA6xxx: Internal tools

Expand Down
30 changes: 30 additions & 0 deletions Documentation/docs-mobile/messages/xa5306.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: .NET for Android error XA5306
description: XA5306 error code
ms.date: 11/12/2026
f1_keywords:
- "XA5306"
---

# .NET for Android error XA5306

## Example messages

```text
error XA5306: The Android CLI is not available for this operating system and architecture: `{os}` `{architecture}`.
```

## Issue

`InstallAndroidDependencies` installs Android SDK packages with Google's
[Android CLI](https://developer.android.com/tools/agents/android-cli). Google
does not publish the Android CLI for the current operating system and processor
architecture. The Android CLI is available for Windows x64, macOS (x64 and
Arm64), and Linux (x64 and Arm64).

## Solution

Run `InstallAndroidDependencies` on a supported operating system and
architecture. Alternatively, install the Android SDK packages with Android
Studio or the Android SDK command-line tools, and set `$(AndroidSdkDirectory)`
to that Android SDK.
30 changes: 30 additions & 0 deletions Documentation/docs-mobile/messages/xa5307.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: .NET for Android error XA5307
description: XA5307 error code
ms.date: 11/12/2026
f1_keywords:
- "XA5307"
---

# .NET for Android error XA5307

## Example messages

```text
error XA5307: The Android CLI downloaded from `{url}` has SHA-256 `{actual}`, but SHA-256 `{expected}` was expected. The Android CLI will not be used.
```

## Issue

`InstallAndroidDependencies` downloads a pinned version of Google's
[Android CLI](https://developer.android.com/tools/agents/android-cli). Before it
runs the Android CLI, it makes sure that the SHA-256 hash of the downloaded file
is the same as the hash included with the .NET for Android SDK. The hashes are
different, so the Android CLI is not used. A proxy that changes downloads, an
incomplete download, or a changed file on the server can cause this error.

## Solution

Check network access to the download URL, and try again. Use an up-to-date
.NET for Android SDK. If the error continues, report it with the URL and both
hashes. Do not use an Android CLI whose hash is not correct.
29 changes: 29 additions & 0 deletions Documentation/docs-mobile/messages/xa5308.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: .NET for Android error XA5308
description: XA5308 error code
ms.date: 11/12/2026
f1_keywords:
- "XA5308"
---

# .NET for Android error XA5308

## Example messages

```text
error XA5308: The Android CLI failed with exit code {code} while it installed Android SDK packages. Output:
{output}
```

## Issue

`InstallAndroidDependencies` runs `android sdk install` from Google's
[Android CLI](https://developer.android.com/tools/agents/android-cli) to install
Android SDK packages. The Android CLI stopped with an error. The error message
includes the last part of the Android CLI output.

## Solution

Read the Android CLI output in the error message. Make sure that you can write
to `$(AndroidSdkDirectory)`, that you have network access, and that the disk has
sufficient free space. Then try again.
2 changes: 1 addition & 1 deletion Documentation/guides/InstallBuildsFromMain.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ On Windows, if your Android SDK is located in `C:\Program Files
administrator to run:

```dotnetcli
> dotnet build -t:InstallAndroidDependencies -p:AndroidManifestType=GoogleV2 -p:AcceptAndroidSDKLicenses=true
> dotnet build -t:InstallAndroidDependencies -p:AcceptAndroidSDKLicenses=true
```

*On macOS, you might not even need `sudo` for this command.*
Expand Down
2 changes: 0 additions & 2 deletions Microsoft.Android.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@
<Project Path="src/Microsoft.Android.Sdk.Analysis/Microsoft.Android.Sdk.Analysis.csproj" />
<Project Path="src/proguard-android/proguard-android.csproj" />
<Project Path="src/Xamarin.Android.Build.Debugging.Tasks/Xamarin.Android.Build.Debugging.Tasks.csproj" />
<Project Path="src/Xamarin.Installer.AndroidSDK/Xamarin.Installer.AndroidSDK.csproj" />
<Project Path="src/Xamarin.Installer.Build.Tasks/Xamarin.Installer.Build.Tasks.csproj" />
<Project Path="src/Xamarin.Installer.Common/Xamarin.Installer.Common.csproj" />
</Folder>
<Folder Name="/Tests/">
<Project Path="tests/generator-Tests/generator-Tests.csproj" />
Expand Down
6 changes: 0 additions & 6 deletions build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,13 @@
<!-- monodroid: in-tree installer/debugging projects under src/Xamarin.Installer.*
and src/Xamarin.Android.Build.Debugging.Tasks. -->
<ItemGroup>
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)ICSharpCode.SharpZipLib.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)ICSharpCode.SharpZipLib.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Build.Debugging.Tasks.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Build.Debugging.Tasks.pdb" />
<_MSBuildFiles Include="@(_LocalizationLanguages->'$(MicrosoftAndroidSdkOutDir)%(Identity)\Xamarin.Android.Build.Debugging.Tasks.resources.dll')" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Common.Debugging.props" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Common.Debugging.targets" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Installer.AndroidSDK.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Installer.AndroidSDK.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Installer.Build.Tasks.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Installer.Build.Tasks.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Installer.Common.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Installer.Common.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Installer.Common.props" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Installer.Common.targets" />
</ItemGroup>
Expand Down
Loading