MonoDroid将完整的Mono虚拟机带到了Android上,让.NET开发人员可以为Google的移动操作系统编写应用程序。开发人员现在可以同时面向iOS,Android和Windows Phone 7编写应用程序了。
MonoDroid是一个类似MonoTouch的框架,让开发人员可以使用C#语言和Mono虚拟机为Android移动操作系统编写应用程序。MonoDroid API包含Silverlight所有的核心类库,但UI接口除外,取而代之的是一套针对原生Android Java API的绑定,用于访问设备相关的功能,例如各种感应器,摄像头,蓝牙等等。
在Windows上进行Andorid开发最好使用Visual Studio专业版(或更高)配合SDK和开发用插件,而SDK会引用Android SDK以便使用Java SDK。在Mac OS X上使用MonoDevelop(基于Mono的跨平台IDE)进行开发要等到Preview 10。此外也有计划提供基于MonoDevelop的Linux开发环境。
MonoDroid为.NET开发人员打开了Android世界。人们可以使用.NET和Mono同时开发Windows Phone 7,iPhone OS以及Android应用程序。不过事情也并非开发人员所希望那般直接:不同的平台有不同的设备及UI API,所以各个地方不可能同时运行相同的代码。开发人员需要清晰地分割业务逻辑以及UI逻辑,后者需要为不同的移动操作系统编写有针对性地代码。这是.NET开发人员尽可能打开市场的重要一步。
MonoDroid的路线图并没有提及正式版的发布时 间,不过Miguel de Icaza提到他们“正在尽可能快地完成Andorid上的Mono”。MonoDroid 1.0将会使用Mono 2.8,并支持C# 3.0,.NET 3.5,垃圾回收,多线程以及其他标准特性,如LINQ。OpenGL也会通过OpenTK API得到支持,这是个OpenGL的面向对象封装类库。OpenTK同样包含在MonoTouch中,因此OpenGL代码可以在Android和 iOS之间共享。
据Icaza称,DeltaEngine使用了MonoDroid,这是一个跨平台的游戏开发引擎,可以在iPhone,Android,Windows Phone 7和Xbox 360上运行游戏。此外,在CES 2011上NVidia演示了一个游戏,Soul Craft,它运行在LG Optimus 2X,这是一个基于NVidia的Tegra 2双核芯片的Android手机。这个游戏运行在MonoDroid上。
MonoDroid将会是个商业产品,定价还未发布。作为参考,MonoTouch的价格从99美元的学生版开始,到399美元的专业版,还有3999美元的5个企业授权套装。
http://www.i-programmer.info/news/80-java/2244-mono-for-android-now-shipping.html
Mono for Android has now been released as version 1.0. It used to be called MonoDroid but trademark issues forbid the use of the word "Droid" in this context.
It brings the full Mono VM to the Android so that you can develop applications using C#. In addition the Dalvik APIs have been bound to C# so that you can make use of many of the built-in facilities of the Android OS. The OpenTK library has also been ported so that you can share the same OpenGL code across Windows, Linux and iPhone.
The current release works with C#, but in principle it should work with other .NET compilers. It comes with a Visual Studio 2010 add-on that allows you to target Android from a familiar environment.
It provides an alternative route for Windows .NET developers who want to create mobile phone apps but don't want to learn or write Java and don't really see Windows Phone 7 as a good bet. It also provides a way of sharing code used to program Windows Phone. If you regard MonoTouch as a way of creating apps for the iPhone then you might be able to share some code with this platform as well.
There are some limitations, however. In particular you can't use the new dynamic features of C# 4.0. In addition new class libraries are provided to the C# application to allow it to access native Android facilities such as the hardware. Not all of the .NET Framework is available either - in particular none of the Forms of Drawing classes are provided - the UI is provided by native Android classes and TK. What this means is that in practice any sharing between a Windows Phone 7 app and an Android app is going to be restricted to core code only. Basically Mono for Android is simply providing you with a way of using C# there are still a lot of new classes to learn how to master and the basic idioms of creating an Android app - Activities, Intents, creating the UI via XML etc.
The good news is that there is a free to download and use version - but it is limited to running the resulting app on the emulator. You can't download your work to a real Android phone unless you buy a commercial licence. The Professional Edition license costs $399, and an Enterprise Edition is also available for $999 per year. Existing MonoTouch users have a 50% discount off their purchase of Mono for Android for a limited time.
Look out for a forthcoming I-Programmer introduction to Mono for Android to get you started using it.
If you would like to be informed about new articles on I Programmer you can either follow us on Twitter, onFacebook, Digg or you can subscribe to our weekly newsletter.