From 90a7c8d851932800fe89ebc04ce6e1451df0b624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Wed, 7 Feb 2024 12:46:03 +0100 Subject: [PATCH 1/3] Update Bionic docs --- src/coreclr/nativeaot/docs/android-bionic.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/coreclr/nativeaot/docs/android-bionic.md b/src/coreclr/nativeaot/docs/android-bionic.md index 39694a8130fa7..95cb7a28b031a 100644 --- a/src/coreclr/nativeaot/docs/android-bionic.md +++ b/src/coreclr/nativeaot/docs/android-bionic.md @@ -6,11 +6,9 @@ Not a full Android experience is available - it's only possible to publish for t 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. -NOTE: There's an existing issue that puts the minimum Android version where things work to Android 10: https://github.com/dotnet/runtime/issues/92196 - To build for Bionic: -* Ensure you have [Android NDK](https://developer.android.com/ndk/downloads) for your system downloaded and extracted somewhere. We build and test with NDK r23c but anything newer should also work. Double check with the NDK version referenced [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/testing/libraries/testing-android.md), which might be more up-to-date than this document. +* Ensure you have [Android NDK](https://developer.android.com/ndk/downloads) for your system downloaded and extracted somewhere. We build and test with NDK r23c but anything newer should also work. Newer releases of the NDK might require a workaround (#92272). Double check with the NDK version referenced [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/testing/libraries/testing-android.md), which might be more up-to-date than this document. * Update your PATH to include `{NDK_ROOT}\toolchains\llvm\prebuilt\{OS_ARCH}\bin`. Replace `{NDK_ROOT}` with the path where you extracted the NDK, and replace `{OS_ARCH}` with your host OS and architecture (e.g. windows-x86_64 or linux-x86_64). Make sure this entry is first in your path - we need to make sure that running `clang` will execute `clang` from this directory. * You can either create a new project or use an existing project. For this guide, let's create a new one: ```sh From c9cccf8c685674ac753d99d70ea47ac53e881a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Wed, 7 Feb 2024 12:47:19 +0100 Subject: [PATCH 2/3] Update android-bionic.md --- src/coreclr/nativeaot/docs/android-bionic.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/nativeaot/docs/android-bionic.md b/src/coreclr/nativeaot/docs/android-bionic.md index 95cb7a28b031a..cf04bb259aa80 100644 --- a/src/coreclr/nativeaot/docs/android-bionic.md +++ b/src/coreclr/nativeaot/docs/android-bionic.md @@ -8,7 +8,7 @@ The minimum API level is 21 at the time of writing the document, but search for To build for Bionic: -* Ensure you have [Android NDK](https://developer.android.com/ndk/downloads) for your system downloaded and extracted somewhere. We build and test with NDK r23c but anything newer should also work. Newer releases of the NDK might require a workaround (#92272). Double check with the NDK version referenced [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/testing/libraries/testing-android.md), which might be more up-to-date than this document. +* Ensure you have [Android NDK](https://developer.android.com/ndk/downloads) for your system downloaded and extracted somewhere. We build and test with NDK r23c but anything newer should also work. Newer releases of the NDK might require a workaround (https://github.com/dotnet/runtime/issues/92272). Double check with the NDK version referenced [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/testing/libraries/testing-android.md), which might be more up-to-date than this document. * Update your PATH to include `{NDK_ROOT}\toolchains\llvm\prebuilt\{OS_ARCH}\bin`. Replace `{NDK_ROOT}` with the path where you extracted the NDK, and replace `{OS_ARCH}` with your host OS and architecture (e.g. windows-x86_64 or linux-x86_64). Make sure this entry is first in your path - we need to make sure that running `clang` will execute `clang` from this directory. * You can either create a new project or use an existing project. For this guide, let's create a new one: ```sh From a8d0a1ec9cd6279a7ac2f8d3388e1e19e6786df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Wed, 7 Feb 2024 22:34:31 +0100 Subject: [PATCH 3/3] Update android-bionic.md --- src/coreclr/nativeaot/docs/android-bionic.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/coreclr/nativeaot/docs/android-bionic.md b/src/coreclr/nativeaot/docs/android-bionic.md index cf04bb259aa80..a5148baa5840a 100644 --- a/src/coreclr/nativeaot/docs/android-bionic.md +++ b/src/coreclr/nativeaot/docs/android-bionic.md @@ -8,7 +8,7 @@ The minimum API level is 21 at the time of writing the document, but search for To build for Bionic: -* Ensure you have [Android NDK](https://developer.android.com/ndk/downloads) for your system downloaded and extracted somewhere. We build and test with NDK r23c but anything newer should also work. Newer releases of the NDK might require a workaround (https://github.com/dotnet/runtime/issues/92272). Double check with the NDK version referenced [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/testing/libraries/testing-android.md), which might be more up-to-date than this document. +* Ensure you have [Android NDK](https://developer.android.com/ndk/downloads) for your system downloaded and extracted somewhere. We build and test with NDK r23c but anything newer should also work. Double check with the NDK version referenced [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/testing/libraries/testing-android.md), which might be more up-to-date than this document. * Update your PATH to include `{NDK_ROOT}\toolchains\llvm\prebuilt\{OS_ARCH}\bin`. Replace `{NDK_ROOT}` with the path where you extracted the NDK, and replace `{OS_ARCH}` with your host OS and architecture (e.g. windows-x86_64 or linux-x86_64). Make sure this entry is first in your path - we need to make sure that running `clang` will execute `clang` from this directory. * You can either create a new project or use an existing project. For this guide, let's create a new one: ```sh @@ -27,6 +27,17 @@ Command line apps are not very interesting for Android. The more interesting sce For an example of a Native AOT shared library invoked through JNI from Java see https://github.com/josephmoresena/NativeAOT-AndroidHelloJniLib. +## Known issues + +If you hit `error : version script assignment of 'V1.0' to symbol '_init' failed: symbol not defined` - this is a known issue https://github.com/dotnet/runtime/issues/92272, you can add following lines to your csproj to work around: + +```xml + + + + +``` + ## Libssl dependency Crypto in .NET is implemented on top of OS-provided crypto libraries (we do not build or service crypto algorithm implementations). Since Android doesn't come with the standard openssl library inbox, your app will need to provide it. The runtime code can handle various versions of the openssl library. The library has to be placed next to the app.