₦airaland Forum

Welcome, Guest: Join Nairaland / LOGIN! / Trending / Recent / New
Stats: 2,185,115 members, 4,764,451 topics. Date: Sunday, 17 February 2019 at 08:46 AM

No Java Required: Write Android Apps In C# - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / No Java Required: Write Android Apps In C# (6959 Views)

Creating Apps In Kivy By Dusty Phillips. Ebook Download / Some Amazing Apps In The MTN Nextapp Store / [problem] Write A Program In C++ That Finds The Hcf Of 2 Numbers Without Using A Recursive Function (2) (3) (4)

(1) (2) (Reply) (Go Down)

No Java Required: Write Android Apps In C# by Beaf: 2:52pm On Jul 09, 2012
[size=14pt]No Java Required: Write Android Apps in C#[/size]
XobotOS is a Xamarin-developed project that translated millions of lines of Java to C#.
By Keith Ward
05/11/2012

Java is the underlying code for the Android OS. But one company has changed all that, ripping out most of the Java and replacing it with C#.

That means .NET developers can code in a familiar language and produce apps that leverage C#'s advantages, including speed increases.

It started as a skunkworks project for Xamarin. Xamarin's claim to fame is Mono, an open-source framework allowing Android and iOS apps to be built using C# running on top of Java. Now, with what the company calls the XobotOS Research Project, the Java layer has been removed via a "machine translation of Android from Java to C#," according to a blog post from Xamarin CTO Miguel de Icaza.

Building XobotOS involved converting more than a million lines of Java code into C#, de Icaza wrote. A tool called Sharpen was used to help in the translation, and the project resulted in an improved version of Sharpen, de Icaza says. Most of Androids layouts and controls, de Icaza says, have been converted, and to demonstrate, the post includes a Java-free screenshot of XobotOS running on a Linux desktop.

In terms of speed improvements, the blog includes a bar chart of a benchmark from a simple binary tree implementation in Java and C#. The chart shows a huge increase in performance between the two languages.

Xamarin has made XobotOS available on github. de Icaza says that XobotOS won't be "a focus" going forward, as the company wants to put its efforts toward its core products, Mono for Android and MonoTouch.

One other possible benefit of using XobotOS for Android development is that it would eliminate the kind of potential legal entanglements that Google finds itself in with Oracle, the patent-holder for Java. Replacing Java with C# would, of course, inoculate developers from the clutches of Oracle's lawyers.

http://visualstudiomagazine.com/articles/2012/05/11/no-java-required-write-android-apps-in-c-sharp.aspx

3 Likes

Re: No Java Required: Write Android Apps In C# by Beaf: 2:54pm On Jul 09, 2012
...And C# casts its conquering eye to the deep ends of the horizon. grin

Nice!

Get your copy of the C# Android bundle, here:
https://github.com/xamarin/XobotOS/

1 Like

Re: No Java Required: Write Android Apps In C# by whoelse(m): 11:28pm On Jul 09, 2012
Would have been nice. Problem is its not a focus going forward so we're still kinda stuck with java android.
Re: No Java Required: Write Android Apps In C# by xterra2(m): 8:55am On Jul 10, 2012
Thuis is bad news to me sad
Am a big java fan
Java over .NET anyday,anytime

1 Like

Re: No Java Required: Write Android Apps In C# by Nobody: 2:37pm On Jul 10, 2012

2 Likes

Re: No Java Required: Write Android Apps In C# by xterra2(m): 6:25pm On Jul 10, 2012
Well I want users who want to write android app to use java, by force by force
Anyway, this doesn't make c# better than java
Java all the way

1 Like

Re: No Java Required: Write Android Apps In C# by gsmcoder: 7:07pm On Jul 10, 2012
Java and delphi remains my preferred languages both
for mobile and reverse engineering.
Re: No Java Required: Write Android Apps In C# by pally212(m): 7:12pm On Jul 10, 2012
I love java
Re: No Java Required: Write Android Apps In C# by gsmcoder: 7:16pm On Jul 10, 2012
yea, the xamarin seems interesting. playing around with it now. cheesy cheesy cheesy
Re: No Java Required: Write Android Apps In C# by prodam(m): 7:25pm On Jul 10, 2012
yahoo!!!

thank God, I have a hope as a .NET developer
Re: No Java Required: Write Android Apps In C# by betrani(m): 7:41pm On Jul 10, 2012
whoelse: Would have been nice. Problem is its not a focus going forward so we're still kinda stuck with java android.
Java bit-code developed android in the first instance! By my understanding Sharpen converted Java scripts to C#! I still think programmers would do a lot of coding wit Java which would ve to be converted to C#! C# as a programming language for nw I won't say would alone develop Android OS! I c the scenario of combinin it with Java as is d case with web designin! Php with asp.net, java, html,xml xhtml etc!
Re: No Java Required: Write Android Apps In C# by ikp4succes(m): 7:43pm On Jul 10, 2012
i mean it should be possible to write android programs with C# becos java and C# looks a little bit familiar in syntax, but i dunno why Microsoft will allow someone to tamper with c# compiler or license to benefit Google , when its not a windows application or window mobile app, am sure you will have to do a lot of work. i have some questions to ask though?
Will this C# support Android XMl integration.
What about google api's.
how many resources will C# carry.
Is there a vast website that shows you how to use this new tool.
is there a virtual android where i can run my program for test.

1 Like

Re: No Java Required: Write Android Apps In C# by lasunray(m): 8:25pm On Jul 10, 2012
pls guys, how can I learn JAVA?

I'd appreciate positive responses.
Re: No Java Required: Write Android Apps In C# by xterra2(m): 8:51pm On Jul 10, 2012
::gsmcoder:::
yea, the xamarin seems interesting. playing around with it now. cheesy cheesy cheesy

Good let me know how it goes
Please keep me informed
prodam: yahoo!!!

thank God, I have a hope as a .NET developer
Have hope, but somethings you can't do with c# you'll have to use java
Re: No Java Required: Write Android Apps In C# by raynold17(m): 9:27pm On Jul 10, 2012
please I use an android phone and I don't understand what u guys are saying should I be worried or what. please translate to English.
Re: No Java Required: Write Android Apps In C# by prodam(m): 10:41pm On Jul 10, 2012
xterra2 If I hear.
Re: No Java Required: Write Android Apps In C# by Beaf: 11:40pm On Jul 10, 2012
xterra2: Well I want users who want to write android app to use java, by force by force
Anyway, this doesn't make c# better than java
Java all the way

I think this argument only takes place in 9ja these days. Lol!
C# has risen from being a better Java to becoming the defacto standard for programming languages, Java will never catch up - Oracle is more interested in hounding people over patents.

Anyway, every man has his favourite weapon.
Re: No Java Required: Write Android Apps In C# by Beaf: 11:43pm On Jul 10, 2012
I'm really happy about the XobotOS library. It is left for the community to pick it up and run with it; personally, it is going to be of immense benefit to me.
I wonder if it will make some .NET GUI portable to the Android platform. .NET GUI tools tend to be much better than anything else out there.
Re: No Java Required: Write Android Apps In C# by Javanian: 11:49pm On Jul 10, 2012
@Beaf i wonder what will be your faith if windows should fall grin...
Re: No Java Required: Write Android Apps In C# by Beaf: 12:02am On Jul 11, 2012
Javanian:
@Beaf i wonder what will be your faith if windows should fall grin...

You mean what would be the Worlds fate. Windows powers 95% of PC's, there is a Windows machine in every home.
Simply put, its not gonna happen.
Re: No Java Required: Write Android Apps In C# by ektbear: 12:17am On Jul 11, 2012
Java and C# are quite similar, from what I hear. And Java is pretty easy to pick up, if you are familiar with and C or C++ syntax language.

Does it translate your C# source into Java bytecode or something? If not, then you lose access to most of the existing Android libraries. Or have to wait for them to be rewritten.

Honestly, not sure how much of an impact this will have.
Re: No Java Required: Write Android Apps In C# by oshoppy: 12:33am On Jul 11, 2012
I am working on a project that requires me to develop an app....please if we have developers in the house that can do this and get paid...please contact me and we can discuss buiz. nice thread.
Re: No Java Required: Write Android Apps In C# by xterra2(m): 12:48am On Jul 11, 2012
ikp4succes: i mean it should be possible to write android programs with C# becos java and C# looks a little bit familiar in syntax, but i dunno why Microsoft will allow someone to tamper with c# compiler or license to benefit Google , when its not a windows application or window mobile app, am sure you will have to do a lot of work. i have some questions to ask though?
Will this C# support Android XMl integration.
What about google api's.
how many resources will C# carry.
Is there a vast website that shows you how to use this new tool.
is there a virtual android where i can run my program for test.
yes there is a virtual android where you can test your apps
i have it installed on my system to test an android app i made
note that it is very sluggish, people hate it so i use a friend's phone to test it
you can get it by downloading the android sdk, configuring it for the version youre targeting and setting up the avd (android virtual device) and you can test your app smiley

raynold17 :
please I use an android phone and I don't understand what u guys are saying should I be worried or what. please translate to English.
You're and android user not a developer you shouldn't worry about it
Oya comot for this thread angry

Beaf: I'm really happy about the XobotOS library. It is left for the community to pick it up and run with it; personally, it is going to be of immense benefit to me.
I wonder if it will make some .NET GUI portable to the Android platform. .NET GUI tools tend to be much better than anything else out there.
I do agree .NET GUI tools are superiod to that of java
Chei, beaf so you're among the lazy devs who use GUI ?
We did a mysql + java project recently one guy was using code literraly setsize(400,400); e.t.c and I used GUI chei I think sey you be correct programmer so you be lazy programmer like me Nawawo
I have seen people using eclipse(no java GUI) for desktop applications :O somebody don kolo

Beaf:

You mean what would be the Worlds fate. Windows powers 95% of PC's, there is a Windows machine in every home.
Simply put, its not gonna happen.
Except th windows I have in my house is only for visual studio and sql server java, dreamweaver, even browsing all done on a mac
Windows is a crappy OS, windows is beyond rubbish, Mac is the way
I have visual stuido 2010 ultimate as a startup program go to the windows partition and boom visual studio is open,only for thay I can't use crappy windoze

ekt_bear: Java and C# are quite similar, from what I hear. And Java is pretty easy to pick up, if you are familiar with and C or C++ syntax language.

Does it translate your C# source into Java bytecode or something? If not, then you lose access to most of the existing Android libraries. Or have to wait for them to be rewritten.

Honestly, not sure how much of an impact this will have.

I find c# harder than java, I hate it angry
I don't why its harder but c# is hard angry angry
Sweet java is multi platform, my app ade in windows 7 with java, I copied the .jar file to mac worked, to ubuntu & fedora still worked love java
Anyway let me not turn this to a java vs c#
Re: No Java Required: Write Android Apps In C# by xterra2(m): 12:51am On Jul 11, 2012
oshoppy: I am working on a project that requires me to develop an app....please if we have developers in the house that can do this and get paid...please contact me and we can discuss buiz. nice thread.

Nawawo
You should have provided more info
Tell me a summary of the project and the language involved so I can know what am dealing with
Okay ?
Re: No Java Required: Write Android Apps In C# by Nobody: 12:59am On Jul 11, 2012
Or you could just use Mono.net, which builds for ios and android.

But I hate c# for not allowing me to dynamically implement abstract classes and interfaces.
E.g can't do
Thread interfaceObj = new Thread(){
public void run(...)
{
//stuff you want this thread to do
}
}.start();
Re: No Java Required: Write Android Apps In C# by Beaf: 1:50am On Jul 11, 2012
^
Dude, what you have just done is attempted assault, ra'pe, burglary, defamation... Make I continue? Lol!
C# (or .NET) can do a thousand and one more powerful things than the piece of code you wrote (has nuff powerful parallel/threading libraries)
Also, you can dynamically implement abstract classes, interfaces, modules, any type. You can also load and create and assemblies on the fly.

...In short, with C#, you can raise the dead. cool grin
Re: No Java Required: Write Android Apps In C# by Beaf: 2:16am On Jul 11, 2012
Excerpts from the Xamarin blog:

[size=14pt]Android Ported to C#[/size]

Oracle and Google are currently in a $1 billion wrestling match over Google’s use of Java in Android.

But 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.



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.

Last July when Xamarin was getting started, we got our team together in Boston to plan the evolution of Mono on iOS and Android. After a day of kayaking in the Charles River, we sat down to dinner and turned our attention to how we could improve the performance and battery life of applications on Android, and make our own Mono for Android even better.

[size=14pt]The XobotOS Research Project[/size]

The result of our efforts is that today we have most of Android’s layouts and controls entirely in C#. Here are some screenshots of XobotOS running on a Linux workstation, no Java involved:



Getting to this point required that the majority of the Android Java code be translated from Java to C#, so what you see above represents very significant progress. So how did we do it?

[size=14pt]Java Translation via Sharpen[/size]

Android’s core codebase contains over a million lines of Java code, and we knew we wanted to be able to stay up to date with new releases of Android — in fact, we started with the Android 2.x source code back in 2011, and then upgraded XobotOS to Android 4.0 when Google open sourced Ice Cream Sandwich earlier this year. So for us, the only reasonable option was to do a machine translation of Java to C#, building and maintaining any necessary tools along the way.

The tool we used as a starting point is called Sharpen. Sharpen is famous for helping people such as Frank Krueger port a Java applet to an award-winning iPad app in two months.

We matured Sharpen a lot, and the result is a much-improved Java-to-C# translation tool for everyone. We are releasing this new version of Sharpen today along with the code for XobotOS and we hope that many more people will benefit from it and contribute to it.

[size=14pt]Performance[/size]

So once you have Android running on Mono, the obvious question is — how does Mono perform compared to Dalvik?

[b]When C# came around, Microsoft modified the language in a couple of significant ways that made it easier to optimize. Value types were introduced to allow small objects to have low overheads and virtual methods were made opt-in, instead of opt-out which made for simpler VMs. Later on, Java and C# diverged in the way that they implemented generics. Java went with a full-backwards compatibility approach, while C# baked the support into the runtime. The C# approach led to a simple-to-use, simple-to-understand generics setup as well as being much more performant and complete.

Since then, both the language and the execution environment have continued to evolve and improve. C# went from being a slightly better Java to be light-years ahead. From embracing dynamic programming, bring asynchronicity into the language, introduce iterators, functional programming constructs, embrace parallelism and got a great implementation of generics. Many of the these features came from the research done by Don Syme and his F# team that have kept a steady flow of new ideas getting injected into the language.[/b]

Furthermore, Mono as a virtual machine has matured substantially in the last 10 years and is now considered to be on its 8th generation.

All of this adds up. You can see the massive difference in the performance of structs and generics in this benchmark we ran of a simple binary tree implementation in Java and C#:


http://blog.xamarin.com/2012/05/01/android-in-c-sharp/
Re: No Java Required: Write Android Apps In C# by ektbear: 2:17am On Jul 11, 2012
xterra2:
I find c# harder than java, I hate it angry
I don't why its harder but c# is hard angry angry
Sweet java is multi platform, my app ade in windows 7 with java, I copied the .jar file to mac worked, to ubuntu & fedora still worked love java
Anyway let me not turn this to a java vs c#

I'm surprised that you find c# hard, yet know java.
Re: No Java Required: Write Android Apps In C# by lasunray(m): 3:31am On Jul 11, 2012
confuse!!! yet I want to learn JAVA
Re: No Java Required: Write Android Apps In C# by lasunray(m): 3:32am On Jul 11, 2012
confuse!!! yet, I want to learn JAVA
Re: No Java Required: Write Android Apps In C# by question(m): 7:02am On Jul 11, 2012
lasunray: confuse!!! yet, I want to learn JAVA
If you have the time, patience, will-power and intellect go to http://www.javavideotutes.com/lessons
OR http://javalessons.com/
There are many other similar websites that you can learn from. Good luck.
Re: No Java Required: Write Android Apps In C# by gsmcoder: 7:06am On Jul 11, 2012
Beaf: ^
Dude, what you have just done is attempted assault, ra'pe, burglary, defamation... Make I continue? Lol!
C# (or .NET) can do a thousand and one more powerful things than the piece of code you wrote (has nuff powerful parallel/threading libraries)
Also, you can dynamically implement abstract classes, interfaces, modules, any type. You can also load and create and assemblies on the fly.

...In short, with C#, you can raise the dead. cool grin

grin grin grin grin could you share the formula to raise the dead? grin grin grin needed in jos asap

1 Like

(1) (2) (Reply)

Architectural Differences Between Virtual And Non-Virtual Machines / Are You On The Dark Web? / Trivia Coding Questions (euler Project)

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (0) (1) (2) (3) (4) (5) (6) (7) (8) (9)

Nairaland - Copyright © 2005 - 2019 Oluwaseun Osewa. All rights reserved. See How To Advertise. 210
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.