You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[NDK] Locate and select only compatible NDK versions
Context: dotnet/android#5499
Context: dotnet/android#5526
Context: android/ndk#1427
Context: https://developer.android.com/studio/command-line/variables#envar
Xamarin.Android is not (yet) compatible with the recently released
Android NDK r22 version. Azure build images have recently rolled out an
update which includes NDK r22 and, thus, it breaks builds for customers
using any form of Xamarin.Android AOT build.
In attempt to detect broken/incompatible NDK versions as well as select
the "best one", this commit adds code to scan the known NDK locations in
search of the preferred version. The search is conducted as follows:
1. If the user selected a preferred NDK location, it is always used.
2. Locations specified in the `ANDROID_{HOME,SDK_ROOT}` environment
variables are returned next.
3. Directories in the `PATH` environment variable are examined to find
a valid NDK location.
4. OS-specific known NDK locations are considered.
For each of the returned locations, we now look for the Android SDK
packages containing the NDK. There are two kinds of such packages:
* `ndk-bundle` is the older package which allows for installation of
only one NDK inside the SDK directory
* `ndk/*` is a newer package which allows for installation of several
NDK versions in parallel. Each subdirectory of `ndk` is an `X.Y.Z`
version number of the NDK.
In each of these directories we look for the `source.properties` file
from which we then extract the NDK version and then we sort thus
discovered NDK instances using their version as the key, in the
descending order. The latest compatible (currently: less than 22 and
more than 15) version is selected and its path returned to the caller.
0 commit comments