Mono for Android is a framework that need to be in

2019-07-22 10:46发布

问题:

I'm trying to understand how mono for android works and I'm not found this explanation in official site.

Taking into account that android reads java bytecode, Mono for Android is a framework that need to be installed on android devices or is a compiler that compiles to java byte code?

回答1:

This article on Xamarin's site describes how the architecture is put together.

Long story short, there is nothing compiling C# into Java byte code. Mono for Android applications ship with the Mono runtime embedded in them, which runs side by side with Dalvik (Android's Java virtual machine). The Mono runtime uses callable wrappers in order to facilitate communicating back and forth with Dalvik when needed, but .NET objects talk right to the Mono runtime, rather than Dalvik.

To speed up development, apps in debug mode are set up to use a shared runtime to cut down on deployment time, and allowing multiple apps to share the same runtime. This isn't supported for applications compiled in release mode, though, so any app you release and distribute will contain its own embedded Mono runtime, and will not have a dependency on anything else.



回答2:

From this article

http://visualstudiomagazine.com/articles/2011/02/01/introducing-monodroid-intro.aspx/

MonoTouch creates a native application that contains the Mono runtime embedded within the application. MonoDroid can create two types of applications. The first is a single standalone application, which is similar to a MonoTouch application, with the app and the Mono runtime bound together. Everything that the application needs is embedded within the application. The second type is an application that makes use of a shared runtime that's installed on the device. This is similar to how .NET apps run on Windows. With this type of application, the app, along with other applications written with MonoDroid, can make use of a shared runtime.