How does Xamarin Studio compare to native Android development?

DevToolsGuy / Thursday, January 21, 2016

When developing apps for Android, your first instinct may well be to open up Android Studio. Since this environment gives you all the tools, support and libraries you would want to build an Android app, it would quite naturally be your first choice. It provides you with:

  • A supported and specialized environment which sets up the correct Android SDK
  • A set of code templates
  • Code editing tools
  • Dynamic layout previews, which let you visualize and drag and drop features to design how your app will look
  • A Gradle-based build system
  • Integration with Google’s Cloud platform and many more features

Why then, are so many developers turning to Xamarin Studio to build Android apps? If you get so many great features with Android studio, surely using a third party environment is an unnecessary move.

The answers are simple. Firstly, Xamarin Studio lets developers create Android apps using C#. For those wanting to reuse existing C# skills, and avoid Java, this is a huge benefit. Secondly, Xamarin supports the building of beautiful native user interfaces - your boss will wonder who the new designer is.

But does using a third party development environment take you ‘further away’ from the native app experience? Can Xamarin Studio really compete with native Android development?

Using C#

Most developers build native Android apps in Java - this is the official language. You can use the Android Native Development Kit (NDK) and develop in C and C++, but this tends to make things a lot more complicated with no significant benefits.

Xamarin offers a better alternative when developing in C#. The advantage? You can effectively do anything you would want to do in Java but with added functionality. Take lambdas for instance - in Java for Android they’re simply unavailable, whereas in C# they couldn’t be simpler - which makes functional programmers very happy indeed. Using C#, you have more Types (but do less typing), access to smarter tools and you also get language-level Async.

Native User Interfaces

Developing your app in the Android SDK will of course give you direct access to the native UI, meaning apps will always look and feel just right. It’s logical therefore to assume this would be the best environment for building an Android app.

While it’s certainly true that using the Android SDK will let you take advantage of the native UI, that doesn’t mean it’s the only place you can do so. The folks at Xamarin have built UI design environments for both Visual Studio and Xamarin Studio. These offer specialized UI and UX design tools for Android (as well as iOS and Mac), meaning you get the same power, look and feel of a UI built with the Android SDK.

The Xamarin Android app builder lets you drag controls onto the app builder and configure them using the properties pad - this means you never need to get your hands dirty with XML (unless you want to). You also get to preview layouts across multiple screen resolutions and device form factors simultaneously. To make things even easier, you can also bring in a huge range of additional components such as Infragistics’ Xamarin.Forms Controls.

Will it be up to date?

When you develop within the Android SDK, you know you’ll be up to date with all the latest APIs from Google. For newer products such as Android Wear, you can be confident you’ll have support for the APIs as soon as they’re available.

Guess what? Developers using Xamarin also have instant access to all of Google’s latest Android APIs. Whether it’s Android Wear APIs, or new form factors, Xamarin is always up to date with the latest releases. Xamarin offer full support for Android APIs and their resources pages provide developers with answers to almost any question.

I’d want to move but…

If you’ve spent a long time building your Android apps in Java, it may well be tempting to just stick with what you’re doing - why bother moving to a new environment, even if it does have so many strengths. Xamarin have thought of that too - Xamarin Studio lets you call existing Java code from C#, meaning your code, frameworks and custom controls can be brought directly into your Xamarin app using the environment’s automatic binding generator.

Set your sights high

Xamarin Studio offers a whole range of benefits to any developer when it comes to developing for Android - you get all the pros of using the Android SDK while using a fully supported environment and C#.