Skip to content

Commit 35c89dd

Browse files
authored
Update MaximumCompatibleNDKMajorVersion to be 23 (#144)
* Update MaximumCompatibleNDKMajorVersion to be 23 Fixes https://work.azdo.io/1433453 Users are reporting the following error when trying to use NDK 23 ``` MSB4044: The "MakeBundleNativeCodeExternal" task was not given a value for the required parameter "AndroidNdkDirectory". ``` Earlier in the logs we see this message ``` Skipping NDK in 'C:\ProgramData\Android\android-sdk dk\22.1.7171670': version 22.1.7171670 is out of the accepted range (major version must be between 16 and 21 ``` We need to update the `MaximumCompatibleNDKMajorVersion` to match our new upper limit.
1 parent 0a22957 commit 35c89dd

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ abstract class AndroidSdkBase
1111
{
1212
// When this changes, update the test: Xamarin.Android.Tools.Tests.AndroidSdkInfoTests.Ndk_MultipleNdkVersionsInSdk
1313
const int MinimumCompatibleNDKMajorVersion = 16;
14-
const int MaximumCompatibleNDKMajorVersion = 21;
14+
const int MaximumCompatibleNDKMajorVersion = 23;
1515

1616
static readonly char[] SourcePropertiesKeyValueSplit = new char[] { '=' };
1717

tests/Xamarin.Android.Tools.AndroidSdk-Tests/AndroidSdkInfoTests.cs

+12-10
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void Ndk_MultipleNdkVersionsInSdk ()
7171
{
7272
// Must match like-named constants in AndroidSdkBase
7373
const int MinimumCompatibleNDKMajorVersion = 16;
74-
const int MaximumCompatibleNDKMajorVersion = 21;
74+
const int MaximumCompatibleNDKMajorVersion = 23;
7575

7676
CreateSdks(out string root, out string jdk, out string ndk, out string sdk);
7777

@@ -91,8 +91,10 @@ public void Ndk_MultipleNdkVersionsInSdk ()
9191
"21.2.6472646",
9292
"21.3.6528147",
9393
"22.0.7026061",
94+
"22.1.7171670",
95+
"23.1.7779620",
9496
};
95-
string expectedVersion = "21.3.6528147";
97+
string expectedVersion = "23.1.7779620";
9698
string expectedNdkPath = Path.Combine (sdk, "ndk", expectedVersion);
9799

98100
try {
@@ -137,7 +139,7 @@ public void Ndk_PathInSdk()
137139
File.WriteAllText(Path.Combine(ndkPath, $"ndk-stack{extension}"), "");
138140

139141
var info = new AndroidSdkInfo(logger, androidSdkPath: sdk, androidNdkPath: null, javaSdkPath: jdk);
140-
142+
141143
Assert.AreEqual(ndkPath, info.AndroidNdkPath, "AndroidNdkPath not found inside sdk!");
142144
}
143145
finally
@@ -308,7 +310,7 @@ public void Sdk_GetCommandLineToolsPaths ()
308310
var latestToolsVersion = "latest";
309311
var toolsVersion = "2.1";
310312
var higherToolsVersion = "11.2";
311-
313+
312314
void recreateCmdlineToolsDirectory () {
313315
Directory.Delete (cmdlineTools, recursive: true);
314316
Directory.CreateDirectory (cmdlineTools);
@@ -324,7 +326,7 @@ void recreateCmdlineToolsDirectory () {
324326

325327
Assert.AreEqual (toolsPaths.Count (), 1, "Incorrect number of elements");
326328
Assert.AreEqual (toolsPaths.First (), Path.Combine (sdk, "cmdline-tools", toolsVersion), "Incorrect command line tools path");
327-
329+
328330
// Test that cmdline-tools is preferred over tools
329331
recreateCmdlineToolsDirectory();
330332
CreateFauxAndroidSdkToolsDirectory (sdk, createToolsDir: true, toolsVersion: latestToolsVersion, createOldToolsDir: true);
@@ -347,7 +349,7 @@ void recreateCmdlineToolsDirectory () {
347349
&& toolsPathsList [1].Equals (Path.Combine (sdk, "cmdline-tools", higherToolsVersion), StringComparison.Ordinal)
348350
&& toolsPathsList [2].Equals (Path.Combine (sdk, "cmdline-tools", toolsVersion), StringComparison.Ordinal)
349351
&& toolsPathsList [3].Equals (Path.Combine (sdk, "tools"), StringComparison.Ordinal);
350-
352+
351353
Assert.IsTrue (isOrderCorrect, "Tools order is not descending");
352354
} finally {
353355
Directory.Delete (root, recursive: true);
@@ -386,10 +388,10 @@ static void CreateFauxAndroidSdkToolsDirectory (string androidSdkDirectory, bool
386388
if (createToolsDir) {
387389
string androidSdkToolsPath = Path.Combine (androidSdkDirectory, "cmdline-tools", toolsVersion ?? "1.0");
388390
string androidSdkToolsBinPath = Path.Combine (androidSdkToolsPath, "bin");
389-
391+
390392
Directory.CreateDirectory (androidSdkToolsPath);
391393
Directory.CreateDirectory (androidSdkToolsBinPath);
392-
394+
393395
File.WriteAllText (Path.Combine (androidSdkToolsBinPath, IsWindows ? "lint.bat" : "lint"), "");
394396
}
395397

@@ -399,7 +401,7 @@ static void CreateFauxAndroidSdkToolsDirectory (string androidSdkDirectory, bool
399401

400402
Directory.CreateDirectory (androidSdkToolsPath);
401403
Directory.CreateDirectory (androidSdkToolsBinPath);
402-
404+
403405
File.WriteAllText (Path.Combine (androidSdkToolsBinPath, IsWindows ? "lint.bat" : "lint"), "");
404406
}
405407

@@ -414,7 +416,7 @@ static void CreateFauxAndroidSdkDirectory (
414416
ApiInfo[] apiLevels = null)
415417
{
416418
CreateFauxAndroidSdkToolsDirectory (androidSdkDirectory, createToolsDir, toolsVersion, createOldToolsDir);
417-
419+
418420
var androidSdkPlatformToolsPath = Path.Combine (androidSdkDirectory, "platform-tools");
419421
var androidSdkPlatformsPath = Path.Combine (androidSdkDirectory, "platforms");
420422
var androidSdkBuildToolsPath = Path.Combine (androidSdkDirectory, "build-tools", buildToolsVersion);

0 commit comments

Comments
 (0)