Home » Android » c# – How does Xamarin for Android (Mono for Android) compare to native Android development?

c# – How does Xamarin for Android (Mono for Android) compare to native Android development?

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’ve recently chosen to learn C# and develop mobile apps using C# on Xamarin. Particularly for Windows Phone and Android development. I know that Windows Phone app development is mostly C#, and that Xamarin can compile native code for Android, but how does it compare to native development in Java? Will I be able to use EVERY or at least most (like 90%+) of the Android SDK and extensions using Xamarin?

How to&Answers:

The main thing which I think there is to consider is your preferred programming language – which in your case is C# – and using that. The only thing that is of concern to me when building an app in C# as oppose to Java is their is not as many 3rd party references to use as there is with Java. You will find yourself downloading example files and reverse engineering them in order to learn how to do new features, you will have to search intellisence far more to find what something is using if you can only find a Java based example of something. One thing which you will find though is that it usually can just be the same method as what is in Java but the first letter being capitalized. LINQ is a major benefit I find in data manipulation which is not available in Java.

Good luck with whatever you choose, James

Answer:

I did not do any stats or study of Xamarin C# coverage of Android Java API, but in my work, everything that I needed when porting code from Java to C# was there. Also, Xamarin says that for new Android SDK releases they usually have C# counterparts released within 24 hours. And, as @dotToString remarked, you can add Java jar libraries to Xamarin C# project and make calls to them if necessary.

Performance is another matter – I don’t believe it runs natively on Android. Rather, Mono runtime is somehow interpreting the byte code. I did some comparison of Java vs. Xamarin C# code performance on real life code, see more at:

Does anyone have benchmarks (code & results) comparing performance of Android apps written in Xamarin C# and Java?

Greg

Answer:

you can use all of the android functionality and java library interop. also, you get the advantage of non windows specific .net including linq.