Skip to content
This repository was archived by the owner on Jul 13, 2026. It is now read-only.

Commit 02f7ae7

Browse files
committed
[NDK] Properly detect 64-bit NDK
The code detecting whether an instance of NDK is a 64-bit one assumed that the GNU binutils paths existed below the toolchains dir and used them to check whether the 64-bit platform directory exists under them in order to determine if the NDK is a 64-bit one. NDK r23, however, will remove the GNU binutils completely and those paths no longer exist. Add a check for the `toolchains/llvm/prebuilt/[PLATFORM]` directory existence before the older check so that detection works correctly for NDK r23+.
1 parent 623332d commit 02f7ae7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkBase.cs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ public virtual void Initialize (string? androidSdkPath = null, string? androidNd
8787
if(!string.IsNullOrEmpty(AndroidNdkPath)){
8888
// It would be nice if .NET had real globbing support in System.IO...
8989
stringtoolchainsDir=Path.Combine(AndroidNdkPath,"toolchains");
90-
if(Directory.Exists(toolchainsDir)){
90+
stringllvmNdkToolchainDir=Path.Combine(toolchainsDir,"llvm","prebuilt",NdkHostPlatform64Bit);
91+
92+
if(Directory.Exists(llvmNdkToolchainDir)){
93+
IsNdk64Bit=true;
94+
}elseif(Directory.Exists(toolchainsDir)){
9195
IsNdk64Bit=Directory.EnumerateDirectories(toolchainsDir,"arm-linux-androideabi-*")
9296
.Any(dir =>Directory.Exists(Path.Combine(dir,"prebuilt",NdkHostPlatform64Bit)));
9397
}

0 commit comments

Comments
 (0)