Can be used monodroid for compiling C# code on Android device?
I would like run C# code on the fly on my Android tablet, the monodroid looks like possible solution, but I didn’t found any notice if the monodroid compiler can run only on windows/mac or on the Android too.
Can be used monodroid for compiling C# code on Android device? I would like
Share
I was originally going to post this as a comment on Chris Sinclair’s answer, but figured it was going to end up long enough that it may as well be a separate answer.
I wrote C# to Go, so I can provide some commentary there. It is in fact written using Mono for Android. However, it is not correct to say that Mono for Android does a conversion or compilation from C# into Java. C# code within an application runs on top of the Mono runtime, and callable interfaces are used to talk back and forth between runtimes (see this answer for more details on that).
Back when I first released C# to Go last year I wrote up a blog post describing how I put it together. Basically, I am using a version of Mono’s C# compiler service that I compiled against the Mono for Android profile. All the source for the app is available on GitHub as well.
It’s not a perfect solution as there are some problems with the current implementation (some of which are detailed in the blog post). Currently I’m unable to support creating/compiling classes in the app due to a problem in the Mono runtime. This is a documented problem that has been fixed in later versions of Mono, but since Mono for Android is still based off Mono 2.10 it has not gotten those fixes. My understanding is that later this year Xamarin will begin working on bringing Mono for Android (and also MonoTouch) up to Mono 2.12 which should also bring with it these fixes, plus the C# compiler service right in the box, avoiding the need to bring it in as a separate library as I did.