Skip to content

[Xamarin.Android.Build.Tasks] Use resolved NDK for AOT - #12316

Open
jonathanpeppers wants to merge 1 commit into
mainfrom
jonathanpeppers-fix-issue-7599
Open

[Xamarin.Android.Build.Tasks] Use resolved NDK for AOT#12316
jonathanpeppers wants to merge 1 commit into
mainfrom
jonathanpeppers-fix-issue-7599

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

AOT currently passes the public $(AndroidNdkDirectory) property directly to <GetAotAssemblies/>. When that property is unset but ResolveSdks discovers an NDK from the configured environment, AOT incorrectly behaves as though no NDK was found.

Use the resolved $(_AndroidNdkDirectory) value consistently for AOT while retaining $(AndroidNdkDirectory) as the supported discovery override. Document the public property and its command-line usage.

Fixes #7599


Pull Request
title and
description
should follow the
commit-messages.md workflow documentation, and in particular should include:

  • Useful description of why the change is necessary.
  • Links to issues fixed
  • Unit tests (not applicable; this is an MSBuild property wiring correction and documentation update)

The AOT targets pass the public $(AndroidNdkDirectory) property directly to
<GetAotAssemblies/>.  When that property is unset but ResolveSdks finds an
NDK through the configured development environment, AOT incorrectly behaves as
if no NDK was found.

Pass the resolved $(_AndroidNdkDirectory) value consistently and document
the public property used to override NDK discovery.

Fixes: #7599

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0f915802-edea-4418-8313-f642a6da9c55
Copilot AI review requested due to automatic review settings August 7, 2026 18:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an AOT build correctness issue where AOT was using the public $(AndroidNdkDirectory) property (which may be unset) instead of the resolved NDK path discovered by ResolveSdks, causing AOT to behave as if no NDK was found in some environments. It also documents AndroidNdkDirectory for users who need to override NDK discovery.

Changes:

  • Wire AOT’s <GetAotAssemblies /> task to use the resolved $(_AndroidNdkDirectory) value.
  • Add build-properties documentation for AndroidNdkDirectory, including command-line usage.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.Aot.targets Passes the resolved NDK path into GetAotAssemblies to align AOT behavior with SDK discovery.
Documentation/docs-mobile/building-apps/build-properties.md Documents AndroidNdkDirectory and how to set it for overriding NDK discovery.

Comment thread Documentation/docs-mobile/building-apps/build-properties.md
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Audit AndroidNdkDirectory Use

2 participants