Bump Android minimum API level from 21 to 24#126838
Bump Android minimum API level from 21 to 24#126838simonrozsival wants to merge 7 commits intodotnet:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Raises the minimum supported Android API level from 21 to 24 to align with the move to CoreCLR as the default runtime on Android, and removes compatibility shims/workarounds that were only needed for API 21–23.
Changes:
- Bumps Android min API defaults across build props/targets and task defaults (21 → 24).
- Removes the System.Native
getifaddrsworkaround/shim previously used for older Android API levels. - Simplifies Android crypto/SSL JNI code paths by making API 24+ APIs required and deleting legacy fallback logic.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Directory.Build.props | Sets AndroidApiLevelMin to 24 (repo-wide minimum). |
| eng/native/build-commons.sh | Updates native build script default Android API level to 24. |
| src/mono/msbuild/android/build/AndroidBuild.targets | Updates AndroidLibraryMinApiLevel default to 24. |
| src/tasks/MobileBuildTasks/Android/AndroidProject.cs | Updates task-side default min API level to 24. |
| src/tasks/AndroidAppBuilder/ApkBuilder.cs | Updates builder-side default min API level to 24. |
| src/native/libs/System.Native/pal_interfaceaddresses.c | Removes Android getifaddrs workaround code paths and relies on HAVE_GETIFADDRS. |
| src/native/libs/System.Native/pal_ifaddrs.h (deleted) | Deletes the netlink getifaddrs shim header (no longer needed at API 24+). |
| src/native/libs/System.Native/pal_ifaddrs.c (deleted) | Deletes the netlink getifaddrs shim implementation. |
| src/native/libs/System.Native/CMakeLists.txt | Removes the Android workaround definitions and sources for pal_ifaddrs.c. |
| src/native/libs/System.Security.Cryptography.Native.Android/pal_jni.h | Removes Conscrypt private-API globals and makes several JNI APIs non-optional. |
| src/native/libs/System.Security.Cryptography.Native.Android/pal_jni.c | Makes API 24+ JNI types/methods mandatory; removes legacy Conscrypt reflection wiring. |
| src/native/libs/System.Security.Cryptography.Native.Android/pal_sslstream.c | Removes API 21–23 SSLStatus mapping and legacy SNI/handshake-session workarounds. |
| src/native/libs/System.Security.Cryptography.Native.Android/pal_x509chain.c | Requires API 24+ cert validation APIs and simplifies revocation option handling. |
| src/native/minipal/memorybarrierprocesswide.c | Clarifies membarrier comment to specify “older than API 29”. |
| src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/OperatingSystemTests.cs | Updates Android min-version assertion to 24. |
| src/coreclr/nativeaot/docs/android-bionic.md | Updates documentation to reflect min API level is now 24. |
| docs/workflow/building/coreclr/android.md | Updates Android build docs to reflect min API level is now 24. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8b65125 to
7c91e8d
Compare
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
| [Fact, PlatformSpecific(TestPlatforms.Android)] | ||
| public static void TestIsOSVersionAtLeast_Android_21() => Assert.True(OperatingSystem.IsAndroidVersionAtLeast(21)); // 21 is our min supported version | ||
| public static void TestIsOSVersionAtLeast_Android_24() => Assert.True(OperatingSystem.IsAndroidVersionAtLeast(24)); // 24 is our min supported version |
There was a problem hiding this comment.
This test should actually still pass unchanged, can you introduce a new test and keep the old one? (or use [Theory] with parameters?)
There was a problem hiding this comment.
Sure, we could do that, but I don't see a value of such test. If anything, we might want to completely drop this test.
|
This should allow us to fix #111665 I believe. |
Note
This PR was created with the help of Copilot.
As part of the move to CoreCLR as the default runtime for .NET on Android, we are raising the minimum supported Android API level from 21 to 24.
Raising the required API level to 24 (Android 7.0 Nougat) allows us to drop several compatibility workarounds that existed solely to support API levels 21–23.
Changes
Minimum API level bump:
AndroidApiLevelMininDirectory.Build.propseng/native/build-commons.sh,AndroidBuild.targets,ApkBuilder.cs, andAndroidProject.csRemoved
System.Nativegetifaddrs shim (introduced in #71943, #76370):pal_ifaddrs.c/pal_ifaddrs.h— a netlink-based reimplementation ofgetifaddrs/freeifaddrsthat was needed because Bionic didn't include them until API 24ANDROID_GETIFADDRS_WORKAROUNDbuild flag and runtimedlopen/dlsymfallback inpal_interfaceaddresses.cSimplified
System.Security.Cryptography.Native.Android:SSLEngineResult.Statusenum mapping — ordinal values changed between API 23 and 24 (introduced in [Android] Fix SslStream on Android API 21-23 #94408)OpenSSLEngineImplprivate-field reflection used to access the handshake session on API 21–23; now usesSSLEngine.getHandshakeSession()directly (introduced in [Android] Fix SslStream on Android API 21-23 #78918)SNIHostName/SSLParameters.setServerNames()directly (introduced in [Android] Fix SslStream on Android API 21-23 #78918)CertPathValidatorException.getReason(),CertPathValidatorException.BasicReason,PKIXReason,PKIXRevocationChecker, and related cert validation APIs required (available since API 24)Tests and documentation:
OperatingSystemTeststo assert API 24 as the minimum