Mono Ports Android to C#
Written by Mike James   
Friday, 04 May 2012

Would Google have been better off adopting C# as the basis for the Android operating system's development language and .NET for its runtime? The Mono team decided to find out with a little experiment. They did a conversion.

 

androidnet

 

 

Before you start to imagine the number of man hours it would take to convert the Android system to C#, it is worth saying that this was an automatic port.

Notice also that the Linux code that forms the bulk of the operating system wasn't involved. This is purely a port of the Java sub-systems to C#. The translation used Sharpen, an Eclipse plugin that translates a Java project to C#, and in this case it was faced with over a million lines of Java code to convert.

The project, called XobotOS, allowed the converted code to run on Mono's VM rather that the Dalvik VM built into Android. It seems that the basic assumption that the .NET VM would be faster than the relatively young Dalvik VM was proved correct.

 

monovdalvik

 

You can download XobotOS and the improved Sharpen tool from GitHub.

So would Google have been better going with .NET than Java? It is generally assumed that .NET is a more "dangerous" environment from the point of view of lawsuits than Java, but as Miguel de Icaza points out in the blog entry:

Unlike Sun with Java, Microsoft submitted C# and the .NET VM for standardization to ECMA and saw those standards graduated all the way to ISO strong patent commitments. The .NET framework is also covered by Microsoft’s legally binding community promise.

However, many in the open source community are very suspicious of the "community promise" which doesn't give away any patent rights. Many fear that if any project used .NET technology to good effect then Microsoft would reconsider its position and want a slice of the cake. As it turns out, Google was no better off going with Java and facing off against Oracle.

One interesting point is that with Microsoft's increasing preference for C++ and non-managed code, there is real possibility that it really doesn't care how .NET is used in other systems. As it is, Mono is rapidly becoming the only champion that the wider .NET technology has left.

Will we see a packaged and polished version of XobotOS, perhaps as part of Mono's offering for Android? 

This seems unlikely as it would require a complete change or addition to a phone's system software. Even if it is faster and results in less battery drain, the idea of making a change as big as Java to C# is a big undertaking. Some of the code may well make its way into Mono for Android and iOS.

As Miguel de Icaza says:

"A project that we started because we thought it would be fun to do has turned out to yield some serious benefits for our products. It’s important for a startup to stay focused, but sometimes you have to try something crazy to make progress. And who knows, maybe Google will thank us some day"

The final question is to do with copyright and patents. If Google loses the lawsuit, and Oracle ends up owning the copyright on the Java APIs and source code, how does this affect a C# version which was simply obtained by compiling the original Android Java to C#? I'm not a lawyer but somehow I don't think you can avoid the problems by simply re-compiling the code. If a clean room re-implementation doesn't get you off the hook, neither does recompiling the original code. So I doubt Miguel will be hearing from Google soon, but a call from Oracle seems all too likely.

 

androidnet

 

More Information

XobotOS available on github

Sharpen on github

Xamarin blog

Related Articles

Open Source XNA for Windows 8 Metro

The War At Microsoft - Managed v Unmanaged

Xamarin's first Mono release

 

espbook

 

Comments




or email your comment to: comments@i-programmer.info

 

To be informed about new articles on I Programmer, subscribe to the RSS feed, follow us on Google+, Twitter, Linkedin or Facebook or sign up for our weekly newsletter.

 

Banner


Effortless ERD Design With Prisma Markdown
21/10/2024

Prisma Markdown is a new tool that takes the pain out of drawing entity relationship diagrams. An essential help if your design is database driven rather than code driven.



The Data Engineering Vault
11/10/2024

A curated network of knowledge designed to facilitate exploration, discovery, and deep learning in the field of data engineering.


More News

Last Updated ( Friday, 04 May 2012 )