Google Could Have Used C# for Android: Xamarin

Published: May 3, 2012
Updated: Feb 2, 2021
3 minute read
eWeek のコンテンツおよび製品のおすすめは、編集上の独立性を保っています。パートナーへのリンクをクリックすると、当社が報酬を得る場合があります。 詳細を見る

Xamarin has ported Google€™s Java-based Android software to use C# and the .NET framework.

In light of the ongoing legal battle between Google and Oracle over Java, this development proves that there are options for Google if Oracle triumphs.

The research project, called XobotOS, ported Android 4.0 from Java/Dalvik to C# to explore the possibilities of improving the performance and memory footprint benefits that C# brings in by leveraging the best parts of .NET/C#, such as real generics, P/Invoke, structures, etc. And they have opened the source code for it under Apache 2.0 License.

Xamarin CTO Miguel de Icaza, in a blog post about the project, said:

€œJava is not the only way to build native apps on Android. In fact, it€™s not even the best way: we have been offering C# to Android developers as a high-performance, low-battery-consuming alternative to Java. Our platform, Mono, is an open-source implementation of the .NET framework that allows developers to write their code using C# while running on top of the Java-powered operating system, and then share that same code with iOS and Windows Phone.€

Indeed, de Icaza added, €œ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.€

Indeed, in a 2005 email, Andy Rubin, Google€™s Android chief told the company’s co-founder Larry Page: €œIf Sun doesn€™t want to work with us, we have two options: 1) Abandon our work and adopt MSFT CLR [Common Language Runtime] VM and C# language; or 2) Do Java anyway and defend our decision, perhaps making enemies along the way.€

De Icaza said Android€™s Dalvik is a young virtual machine and is not as tuned or performant as Xamarin€™s Mono. So the Xamarin team set out to swap Java with C# and avoid the Dalvik limitations. Thus far, the result is that the team has most of Android€™s layouts and controls entirely in C#, de Icaza said.

The team started with a Java translation tool called Sharpen from db4o, which is an open-source Java to C# converter. In the process, the Xamarin team matured the Sharpen tool to improve its Java-to-C# translation capabilities, and on May 1 released a new version of Sharpen along with the code for XobotOS. XobotOS is available on Github.

Advertisement

As a result of their efforts, Mono now blows Dalvik away in benchmark tests, de Icaza said. However, he said, €œOur goal as a company is to provide the best platform for building mobile apps, and so XobotOS will not be a focus for us going forward.€

However, de Icaza in his blog post pointed to a few technologies that have come out of the effort that Xamarin will be able to include in future versions of its products:

  • Direct graphics access to Skia: Currently Mono for Android accesses the underlying graphics libraries through Java; with the code that we built for XobotOS, we will skip the middleman and use Mono€™s P/Invoke to get straight to the native rendering code in Skia.
  • Java to C# tooling: Our new version of Sharpen is available as part of the XobotOS release.
  • Replacing Java code with C# code: We now have the tools necessary to replace some chunks of Java code with C# code where performance is critical and when C# can offer better solutions than Java has. Our plan is to take elements of the research project and integrate those into our products.
Darryl K. Taft

Darryl K. Taft

Content Writer

Darryl K. Taft covers the development tools and developer-related issues beat from his office in Baltimore. He has more than 10 years of experience in the business and is always looking for the next scoop. Taft is a member of the Association for Computing Machinery (ACM) and was named 'one of the most active middleware reporters in the world' by The Middleware Co. He also has his own card in the 'Who's Who in Enterprise Java' deck.

eWeek Logo

eWeek has the latest technology news and analysis, buying guides, and product reviews for IT professionals and technology buyers. The site's focus is on innovative solutions and covering in-depth technical content. eWeek stays on the cutting edge of technology news and IT trends through interviews and expert analysis. Gain insight from top innovators and thought leaders in the fields of IT, business, enterprise software, startups, and more.

TechnologyAdvice が所有・運営しています。 © 2026 TechnologyAdvice. 無断転載を禁じます

広告主に関する開示:このサイトに掲載されている製品の一部は、TechnologyAdvice が報酬を受け取っている企業のものです。この報酬は、製品がこのサイトのどこにどのように表示されるか(表示される順序など)に影響する場合があります。TechnologyAdvice は、市場で入手可能なすべての企業やすべての種類の製品を掲載しているわけではありません。