-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CoreCLR, CoreRT and Android #63384
Comments
Tagging subscribers to this area: @dotnet/area-meta Issue DetailsI want to write parts of my Android application in C#. I don't care about a good developer experience or a supported path necessarily but want to know if CoreCLR (the full runtime) or CoreRT can be compiled against Android NDK platform headers and the basic runtime facilities like GC, exception handling, Null reference handling work. In addition, networking & dns resolution working would be a plus. I know ARM64 support has come a long way, but I wonder if Android platform support issues are still lurking and how many (if any) issues have been diagnosed. I'm also interested in CoreRT, because although my application is written in C# it uses very little of the .net libraries, but does rely on GC, exception handling. I'm not interested in Mono or Xamarin.
|
dotnet/corert#8316 @RalfKornmannEnvision @jkotas seem to be working on this. Any update? Is CoreRT with no real .net libraries but only exception handling and GC and null ref working? ClangSharp by @tannergooding could then be used to generate Android NDK headers C# equivalent and at least developers can write C# for their Android applications without using Mono. |
I looked into this in the context of NativeAOT (previously named CoreRT) briefly two weeks ago. I have a patch here that gets a build out, but the developer experience around it is not pretty. I haven't actually gotten to testing it too much because I ran out of time I allocated for it and I don't have a pressing need for this right now: The commit has high level description of what to do with it once you get the libraries built. Cc @kant2002 who was also interested in this in the past. |
@MichalStrehovsky the developer experience doesn't need to be pretty, I've seen your work and at least you document the experience even if the steps are onerous. The basic point is that there is a large portion of code, whether ML models, or other on-device logic that a variety of developers have written in C# that could be activated for the developer who is experienced or willing to put in the work. But not all developers are familiar with getting exception handling, other low level quirks needed for a building NativeAOT without your and others expertise. Thank you I will look into this commit. |
I am working on a small project to port JNI to .Net to be usable with NativeAOT. |
Nice! What are the linker problems you're seeing? Did you build for ARM64 Android using the above commit? |
Tagging subscribers to 'arch-android': @steveisok, @akoeplinger Issue DetailsI want to write parts of my Android application in C#. I don't care about a good developer experience or a supported path necessarily but want to know if CoreCLR (the full runtime) or CoreRT can be compiled against Android NDK platform headers and the basic runtime facilities like GC, exception handling, Null reference handling work. In addition, networking & dns resolution working would be a plus. I know ARM64 support has come a long way, but I wonder if Android platform support issues are still lurking and how many (if any) issues have been diagnosed. I'm also interested in CoreRT, because although my application is written in C# it uses very little of the .net libraries, but does rely on GC, exception handling. I'm not interested in Mono or Xamarin.
|
Not with that commit yet, I promise to do it in the medium term! Removing them I was able to create a .so with libc++_shared.so dependency but when the Android App tried to load it a missing symbol error was ocurred. |
It took me too long to get it but I finally get to successfully compile a JNI library and use it from an Android Application. NativeAOT is GREAT!!!! |
@josephmoresena would be great if you share small sample, so everybody could follow your lead! |
Of course, I still don't know all this about Android very well (I had not used Android Studio for many years) but the idea is to do something like this: It makes me really very happy because it motivates me even more to continue with the project that I mentioned above. |
The sample is now in this repo. I decided to no include the Android code. |
Support for Bionic builds with the Mono runtime was merged in #66147. The maximum I can see in terms of Android support with NativeAOT is that - Bionic is Android, but without the Java interop part (we don't have plans for Java interop outside Mono). The Bionic configuration could be useful for people who want to build a shared library they can call into like the example from Joseph above, but wouldn't be enough to build entire MAUI apps. There's Mono for that. |
Now that iOS support in NativeAOT is being discussed (#80905), is there a possibility of Android support being extended to include some basic Java Interop? While porting MAUI is understandably a non-starter (at least for now), having enough to run something like Avalonia which renders its own controls might be a bit easier. It would be really nice to have particularly the startup and size benefits of NativeAOT (which have been the largest pain points for me) in .NET android apps. |
@squidink7 nothing is being planned for Android at this time. iOS support has a fair amount of work and so our focus is there. |
I'm working on a C# implementation of JNI for use with NativeAOT. Actually this would go much further than Android (even if my real goal is Android), however, with Android there would be many more problems, we may need to do many things with Android's native libraries (Implementing headers in .NET using PInvoke) or with Java directly (using JNI ). A lot of .NET stuff just doesn't work on Bionic + NativeAOT (Globalization and Networking). |
Is there any chance to see RyuJIT running on Android? |
I want to write parts of my Android application in C#. I don't care about a good developer experience or a supported path necessarily but want to know if CoreCLR (the full runtime) or CoreRT can be compiled against Android NDK platform headers and the basic runtime facilities like GC, exception handling, Null reference handling work. In addition, networking & dns resolution working would be a plus.
I know ARM64 support has come a long way, but I wonder if Android platform support issues are still lurking and how many (if any) issues have been diagnosed.
I'm also interested in CoreRT, because although my application is written in C# it uses very little of the .net libraries, but does rely on GC, exception handling.
I'm not interested in Mono or Xamarin.
The text was updated successfully, but these errors were encountered: