Xamarin has ported Android from Java to C#

The code could be used to build Android phones that don't rely on Java

Xamarin has ported Android to C# in an effort to improve its own development tools and show that the OS doesn't have to be dependent on Java.

Development tools vendor Xamarin was started in May last year to take care of the Mono project, an open source implementation of the .NET framework, after Attachmate decided to drop it following its deal with Novell, where Mono had its home previously.

Today, Xamarin offers cross-platform development tools for iOS and Android.

When working on how to improve the performance of its tool for Android, the company hit a wall because of performance issues with Dalvik, which is Android's virtual machine, it wrote in a blog post on Tuesday.

One idea the Xamarin team had was to translate Android's source code to C#. A few months later skunkworks project XobotOS was born.

The result of the project's efforts is that most of Android's layouts and controls have been ported to C#, and the code is available on GitHub, according to the blog post.

"Turning XobotOS into something that can run on phones can be done ... Someone like Google or Amazon could do it and get 10 years of performance optimization," said Miguel de Icaza, CTO at Xamarin.

As big proponent of C#, de Icaza thinks Google was a little premature when it decided to go with Java for Android. Google is now embroiled in a court battle with Java owner Oracle over whether it violated patents and copyrights in its use of Java.

"I think that C# gets overlooked because it came from Microsoft originally. But today it is an ISO standard," said de Icaza. He contrasts that history with Java's, which Sun submitted for standardization but then withdrew.

Microsoft has also included C# in its Community Promise, which states that the company "irrevocably promises not to assert any" claims against it.

In the end, Xamarin wants to concentrate on improving its development tools, and so XobotOS will not be a focus going forward, the company said.

However, a few technologies that have come out of the effort will be included in future versions of its products.

For example, today, Mono for Android accesses the underlying graphics libraries via Java, but with the code Xamarin built for XobotOS it can skip that step and get straight to the native rendering code in Android's graphics engine.

"Graphics applications will run faster with Mono and C# than they do with Dalvik and Java," said de Icaza.

Xamarin now has the tools necessary to replace some chunks of Java code with C# code where performance is critical and when C# can offer an improvement, as well.

The translation was made easier using a tool called Sharpen, which was originally created by db4object. Xamarin improved the tool, making it more scalable and updating it to work with modern Java idioms, while doing the actual translation work, according to de Icaza.

"Sharpen has a lot of benefits, not only for us but for other people, so we open sourced all of our code. We are hoping it will be useful for other people that are looking at doing Java to C# translations for whatever needs they might have," said de Icaza.

Along with XobotOS, the new version of Sharpen was also published on GitHub.

Send news tips and comments to mikael_ricknas@idg.com

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.
Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Mikael Ricknäs

IDG News Service
Show Comments

Most Popular Reviews

Latest Articles

Resources

PCW Evaluation Team

Tom Pope

Dynabook Portégé X30L-G

Ultimately this laptop has achieved everything I would hope for in a laptop for work, while fitting that into a form factor and weight that is remarkable.

Tom Sellers

MSI P65

This smart laptop was enjoyable to use and great to work on – creating content was super simple.

Lolita Wang

MSI GT76

It really doesn’t get more “gaming laptop” than this.

Jack Jeffries

MSI GS75

As the Maserati or BMW of laptops, it would fit perfectly in the hands of a professional needing firepower under the hood, sophistication and class on the surface, and gaming prowess (sports mode if you will) in between.

Taylor Carr

MSI PS63

The MSI PS63 is an amazing laptop and I would definitely consider buying one in the future.

Christopher Low

Brother RJ-4230B

This small mobile printer is exactly what I need for invoicing and other jobs such as sending fellow tradesman details or step-by-step instructions that I can easily print off from my phone or the Web.

Featured Content

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?