Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
- src/tasks/Crossgen2Tasks/Microsoft.NET.CrossGen.targets
- https://github.com/dotnet/sdk repo > src/Installer/redist-installer/targets/GeneratePKG.targets
-->
<AndroidApiLevelMin>21</AndroidApiLevelMin>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above is a list of all the files that might be hardcoding 21, this PR is missing some.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The offsets-tool.py still has 21

<AndroidApiLevelMin>24</AndroidApiLevelMin>
<iOSVersionMin>13.0</iOSVersionMin>
<tvOSVersionMin>13.0</tvOSVersionMin>
<macOSVersionMin>14.0</macOSVersionMin>
Expand Down
2 changes: 1 addition & 1 deletion docs/workflow/building/coreclr/android.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Supported target architectures:

- Download and install [OpenJDK 23](https://openjdk.org/projects/jdk/23/)
- Download and install [Android Studio](https://developer.android.com/studio/install) and the following:
- Android SDK (minimum supported API level is 21)
- Android SDK (minimum supported API level is 24)
- Android NDK r27c

> [!NOTE]
Expand Down
2 changes: 1 addition & 1 deletion eng/native/build-commons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ build_native()

if [[ "$targetOS" == android || "$targetOS" == linux-bionic ]]; then
# Keep in sync with $(AndroidApiLevelMin) in Directory.Build.props in the repository rooot
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment typo: "repository rooot" should be "repository root".

Suggested change
# Keep in sync with $(AndroidApiLevelMin) in Directory.Build.props in the repository rooot
# Keep in sync with $(AndroidApiLevelMin) in Directory.Build.props in the repository root

Copilot uses AI. Check for mistakes.
local ANDROID_API_LEVEL=21
local ANDROID_API_LEVEL=24
if [[ -z "$ANDROID_NDK_ROOT" ]]; then
echo "Error: You need to set the ANDROID_NDK_ROOT environment variable pointing to the Android NDK root."
exit 1
Expand Down
2 changes: 1 addition & 1 deletion eng/native/gen-buildsys.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ if /i "%__Arch%" == "wasm" (

if /i "%__Os%" == "android" (
:: Keep in sync with $(AndroidApiLevelMin) in Directory.Build.props in the repository rooot
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment typo: "repository rooot" should be "repository root".

Suggested change
:: Keep in sync with $(AndroidApiLevelMin) in Directory.Build.props in the repository rooot
:: Keep in sync with $(AndroidApiLevelMin) in Directory.Build.props in the repository root

Copilot uses AI. Check for mistakes.
set __ANDROID_API_LEVEL=21
set __ANDROID_API_LEVEL=24
if "%ANDROID_NDK_ROOT%" == "" (
echo Error: You need to set the ANDROID_NDK_ROOT environment variable pointing to the Android NDK root.
exit /B 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ The .NET Foundation licenses this file to you under the MIT license.
<CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm'))">armv7</CrossCompileArch>

<CrossCompileAbi>gnu</CrossCompileAbi>
<CrossCompileAbi Condition="$(CrossCompileRid.StartsWith('linux-bionic-')) or $(CrossCompileRid.StartsWith('android-'))">android21</CrossCompileAbi>
<CrossCompileAbi Condition="$(CrossCompileRid.StartsWith('linux-bionic-')) or $(CrossCompileRid.StartsWith('android-'))">android24</CrossCompileAbi>
<CrossCompileAbi Condition="$(CrossCompileRid.StartsWith('linux-musl-')) or $(CrossCompileRid.StartsWith('alpine-'))">musl</CrossCompileAbi>
<CrossCompileAbi Condition="'$(CrossCompileRid)' == 'linux-arm'">gnueabihf</CrossCompileAbi>
<CrossCompileAbi Condition="'$(CrossCompileRid)' == 'linux-bionic-arm' or '$(CrossCompileRid)' == 'android-arm'">androideabi21</CrossCompileAbi>
<CrossCompileAbi Condition="'$(CrossCompileRid)' == 'linux-bionic-arm' or '$(CrossCompileRid)' == 'android-arm'">androideabi24</CrossCompileAbi>
<CrossCompileAbi Condition="'$(CrossCompileRid)' == 'linux-musl-arm'">musleabihf</CrossCompileAbi>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/nativeaot/docs/android-bionic.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Starting with .NET 8 Preview 7, it's possible to build shared libraries and comm

Not a full Android experience is available - it's only possible to publish for two Bionic RID: linux-bionic-arm64 and linux-bionic-x64. Publishing for Android RIDs (android-arm64/android-x64) is not possible. This limited experience corresponds to building with [Android NDK](https://developer.android.com/ndk) from Native code - the limitations are similar. Interop with Java needs to be done manually through JNI, if necessary.

The minimum API level is 21 at the time of writing the document, but search for AndroidApiLevelMin in this repo for more up-to-date information.
The minimum API level has been raised to 24 in .NET 11. Search for `AndroidApiLevelMin` in this repo for the current value.

To build for Bionic:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static void IsOSPlatformVersionAtLeast_InvalidArgs_Throws()
public static void TestIsOSVersionAtLeast_Android() => TestIsOSVersionAtLeast("Android");

[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
Comment on lines 109 to +110
Copy link
Copy Markdown
Member

@jonathanpeppers jonathanpeppers Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should actually still pass unchanged, can you introduce a new test and keep the old one? (or use [Theory] with parameters?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.


[Fact, PlatformSpecific(TestPlatforms.iOS)]
public static void TestIsOSPlatform_IOS() => TestIsOSPlatform("iOS", OperatingSystem.IsIOS);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/msbuild/android/build/AndroidBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
</PropertyGroup>

<PropertyGroup>
<AndroidLibraryMinApiLevel Condition="'$(AndroidLibraryMinApiLevel)' == ''">21</AndroidLibraryMinApiLevel>
<AndroidLibraryMinApiLevel Condition="'$(AndroidLibraryMinApiLevel)' == ''">24</AndroidLibraryMinApiLevel>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 0 additions & 8 deletions src/native/libs/System.Native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/extra_libs.cmake)
set(NATIVE_LIBS_EXTRA)
append_extra_system_libs(NATIVE_LIBS_EXTRA)

if (CLR_CMAKE_TARGET_ANDROID AND NOT HAVE_GETIFADDRS)
add_definitions(-DANDROID_GETIFADDRS_WORKAROUND)
add_compile_options(-Wno-gnu-zero-variadic-macro-arguments)

list (APPEND NATIVE_LIBS_EXTRA -llog)
list (APPEND NATIVE_SOURCES pal_ifaddrs.c)
endif ()

if (GEN_SHARED_LIB)
add_library(System.Native
SHARED
Expand Down
Loading
Loading