Skip to content

Commit

Permalink
Bump to Android NDK r24 (#6469)
Browse files Browse the repository at this point in the history
Changes: https://github.com/android/ndk/wiki/Changelog-r24#changes

The most interesting changes from Xamarin.Android's point of view:

  * GDB has been removed.  Use LLDB instead.  Note that ndk-gdb uses
    LLDB by default, and Android Studio has only ever supported LLDB.
  * Jelly Bean (APIs 16, 17, and 18) is no longer supported.
    The minimum OS supported by the NDK is KitKat (API level 19).
  * Non-Neon devices are no longer supported.  A very small number of
    very old devices do not support Neon so most apps will not notice
    aside from the performance improvement.
  * Additional Apple M1 support: 
      * LLVM tools are now universal binaries.
  • Loading branch information
grendello authored Mar 28, 2022
1 parent d3ad010 commit 38b1236
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Xamarin.Android.Prepare
{
class BuildAndroidPlatforms
{
public const string AndroidNdkVersion = "23b";
public const string AndroidNdkPkgRevision = "23.1.7779620";
public const string AndroidNdkVersion = "24";
public const string AndroidNdkPkgRevision = "24.0.8215888";

public static readonly List<AndroidPlatform> AllPlatforms = new List<AndroidPlatform> {
new AndroidPlatform (apiName: "", apiLevel: 1, platformID: "1"),
Expand Down Expand Up @@ -51,9 +51,9 @@ class BuildAndroidPlatforms
public const string AndroidX86_64_NET6 = AbiNames.TargetJit.AndroidX86_64 + "_NET6";

public static readonly Dictionary<string, uint> NdkMinimumAPI = new Dictionary<string, uint> {
{ AbiNames.TargetJit.AndroidArmV7a, 16 }, { AndroidArmV7a_NET6, 21 },
{ AbiNames.TargetJit.AndroidArmV7a, 19 }, { AndroidArmV7a_NET6, 21 },
{ AbiNames.TargetJit.AndroidArmV8a, 21 }, { AndroidArmV8a_NET6, 21 },
{ AbiNames.TargetJit.AndroidX86, 16 }, { AndroidX86_NET6, 21 },
{ AbiNames.TargetJit.AndroidX86, 19 }, { AndroidX86_NET6, 21 },
{ AbiNames.TargetJit.AndroidX86_64, 21 }, { AndroidX86_64_NET6, 21 },
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ public void BuildAotApplicationAndÜmläüts (string supportedAbis, bool enableL
// Since we overrode minSdkVersion=16, that means we should use libc.so from android-16.
if (ndk22OrNewer) {
// NDK r22 or newer store libc in [toolchain]/sysroot/usr/lib/[ARCH]/[API]/libc.so
StringAssertEx.ContainsRegex (@"\s*\[aot-compiler stdout].*sysroot.*.usr.lib.*16.libc\.so", b.LastBuildOutput, "AOT+LLVM should use libc.so from minSdkVersion!");
StringAssertEx.ContainsRegex (@"\s*\[aot-compiler stdout].*sysroot.*.usr.lib.*19.libc\.so", b.LastBuildOutput, "AOT+LLVM should use libc.so from minSdkVersion!");
} else {
StringAssertEx.ContainsRegex (@"\s*\[aot-compiler stdout].*android-16.arch-.*.usr.lib.libc\.so", b.LastBuildOutput, "AOT+LLVM should use libc.so from minSdkVersion!");
StringAssertEx.ContainsRegex (@"\s*\[aot-compiler stdout].*android-19.arch-.*.usr.lib.libc\.so", b.LastBuildOutput, "AOT+LLVM should use libc.so from minSdkVersion!");
}
}
foreach (var abi in supportedAbis.Split (new char [] { ';' })) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void CheckBundleForSoname (ZipArchive zip, string bundlePath)
string sonameField;

if (elfReaderLlvm) {
arguments = "-dynamic-table";
arguments = "--dynamic-table";
sonameField = "SONAME";
} else {
arguments = "-d";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using NUnit.Framework;
using Xamarin.ProjectTools;
Expand Down Expand Up @@ -440,7 +440,7 @@ public void DirectBootAwareAttribute ()
/* pattern */ "{abi}{minSDK:00}{versionCode:000}",
/* props */ null,
/* shouldBuild */ true,
/* expected */ "216012;316012",
/* expected */ "219012;319012",
},
new object[] {
/* seperateApk */ true,
Expand All @@ -450,7 +450,7 @@ public void DirectBootAwareAttribute ()
/* pattern */ "{abi}{minSDK:00}{screen}{versionCode:000}",
/* props */ "screen=24",
/* shouldBuild */ true,
/* expected */ "21624012;31624012",
/* expected */ "21924012;31924012",
},
new object[] {
/* seperateApk */ true,
Expand All @@ -460,7 +460,7 @@ public void DirectBootAwareAttribute ()
/* pattern */ "{abi}{minSDK:00}{screen}{foo:0}{versionCode:000}",
/* props */ "screen=24;foo=$(Foo)",
/* shouldBuild */ true,
/* expected */ "216241012;316241012",
/* expected */ "219241012;319241012",
},
new object[] {
/* seperateApk */ true,
Expand All @@ -470,7 +470,7 @@ public void DirectBootAwareAttribute ()
/* pattern */ "{abi}{minSDK:00}{screen}{foo:00}{versionCode:000}",
/* props */ "screen=24;foo=$(Foo)",
/* shouldBuild */ false,
/* expected */ "2162401012;3162401012",
/* expected */ "2192401012;3192401012",
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void TestNdkUtil ()
Assert.IsTrue (ndk.ValidateNdkPlatform (arch, enableLLVM: false));
Assert.AreEqual (0, errors.Count, "NdkTools.ValidateNdkPlatform should not have returned false.");
int level = ndk.GetMinimumApiLevelFor (arch);
int expected = 16;
int expected = 19;
Assert.AreEqual (expected, level, $"Min Api Level for {arch} should be {expected}.");
var compilerNoQuotes = ndk.GetToolPath (NdkToolKind.CompilerC, arch, level);
Assert.AreEqual (0, errors.Count, "NdkTools.GetToolPath should not have errored.");
Expand Down
2 changes: 1 addition & 1 deletion tests/Mono.Android-Tests/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="Mono.Android_Tests">
<uses-sdk android:minSdkVersion="16" />
<uses-sdk android:minSdkVersion="19" />
<application android:debuggable="true" android:label="Xamarin.Android.RuntimeTests" android:name="android.apptests.App" android:usesCleartextTraffic="true">
<activity android:name="android.apptests.RenamedActivity" android:configChanges="keyboardHidden" />
</application>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="Mono.Android_TestsAppBundle">
<uses-sdk android:minSdkVersion="16" />
<uses-sdk android:minSdkVersion="19" />
<application android:label="Xamarin.Android.RuntimeTestsAppBundle" android:name="android.apptests.App" android:usesCleartextTraffic="true">
<activity android:name="android.apptests.RenamedActivity" android:configChanges="keyboardHidden" />
</application>
Expand Down

0 comments on commit 38b1236

Please sign in to comment.