black and white paint

The Good and The Bad of Xamarin Mobile Development

When considering iOS or Android app development, most of us think about Objective-C vs Swift, and Java first of all. Being considered native tech stacks, they are naturally most often used mobile development tools when it comes to iOS and Android app development. However, there are more ways to build performant and user-friendly mobile apps. And Xamarin is one of them. In this article, we conduct an in-depth Xamarin review and compare it to native and cross-platform mobile development solutions on the market. If you know the basics, consider skipping to the sections you are interested in.

What Is Xamarin?

It’s impossible to ignore Xamarin when talking about the key approaches to mobile application development. Xamarin is a tool used for cross-platform mobile app development that allows engineers to share up to 90 percent of code across major platforms. Being a comparatively new tool, it is based on the Microsoft technology stack and already has a community of over 1.4 million developers.

The platform was built by the developers behind Mono, an open source development platform based on the .NET Framework, led by Miguel de Icaza and first introduced in 2001. The Xamarin company was founded on May 16, 2011.

However, unlike its predecessor, Xamarin was created as a commercial project until the company was acquired by Microsoft in 2016. Xamarin became a popular cross-platform product for developing mobile apps within the Microsoft ecosystem. This acquisition broke the financial barrier for using Xamarin. As Microsoft made Xamarin SDK open-source, it became part of Xamarin Visual Studio Integrated Development Environment (we discuss best IDEs to use for Xamarin development below). What are the main features of Xamarin?

C# language. Xamarin uses a single language, C#, to create apps for all mobile platforms. Unlike interpreted solutions, such as Appcelerator Titanium, Xamarin is natively compiled, which makes it a go-to option for building high-performance apps with native look and feel.

Based on .NET framework. C# is a mature language with strong safety-typing that prevents code from unexpected behavior. As C# is one of the .NET framework languages, it can be used with a number of useful .NET features such as Lambdas, LINQ, and Asynchronous programming (async/await).

The Pros and Cons of .NET FrameworkPlayButton

.NET explained

Technically speaking, Xamarin uses C# and native libraries wrapped in the .Net layer for cross-platform app development. Such applications are often compared to native for both iOS and Android mobile development platforms in terms of performance and user experience. Additionally, Xamarin can leverage all native and the latest API access to utilize underlying platform capabilities in Xamarin apps such as ARKit on iOS or Android Multi-Window.

Xamarin platform

While the code related to business logic, database access, and network communication can be shared across all platforms, Xamarin allows you to create a platform-specific UI code layer. Thus, Xamarin cross-platform apps look 100% native on any device, providing a better user experience, as compared to generic hybrid apps.

Compilation. The platform has two major products: Xamarin.iOS and Xamarin.Android. In the case of iOS, the source code is compiled directly into native ARM assembly code (Ahead-of-Time compilation), while Android Xamarin apps are first compiled down to Intermediate Language and then - into native assembly code at runtime (Just-in-Time compilation). However, in both cases the process is automated and tailored to handle such issues as memory allocation, garbage collection, and platform interoperability by default.

Xamarin.Forms. Xamarin.Forms is a separate product designed to create prototypes or mobile apps sharing up to 100 percent of the code across iOS and Android.

Xamarin.Mac. Additionally, engineers can use Xamarin.Mac to build applications for Mac OS.  These and some other products from the Xamarin stack will be discussed in a bit.

Platform SDKs. Xamarin provides access to platform-specific SDKs (Cocoa Touch for iOS and Android SDK) via simple C# syntax.

Platform-specific code bindings. In most cases engineers will be able to handle development keeping the native look and feel of the respective platforms within the Xamarin environment. However, Xamarin allows you to call existing platform code (e.g. Swift for iOS) if you must reuse some modules or realize some platform-specific functions like barcode scanning, PayPal or Google Analytics integration.

Support of wearables. Xamarin supports building apps for Apple and Android Watch devices. Engineers can use Visual Studio both for Mac and Windows to build iOS Apple Watch apps. Also, Xamarin fully supports Android Wear.

Xamarin project structure. Most of the Xamarin-related work is expected to be run via a Windows development computer with Visual Studio and Xamarin installed. The apps can be debugged straight from the desktop or on devices and emulators. If you plan to develop iOS apps on Windows, it’s also possible as Visual Studio connects to the iOS storyboard designer and iOS simulator. There’s also Visual Studio for Mac which allows for running a simulator on the Mac or directly on a tethered iPhone. Debugging is run via Visual Studio.

Xamarin project structure

Xamarin project structure. Image source: Developer Support Blog

To get a more in-depth understanding of Xamarin engineering aspects consider checking these resources:

Main Xamarin Documentation Hub

Xamarin.Android Documentation

Xamarin.iOS Documentation

Xamarin.Forms Documentation 

Visual Studio for Xamarin

Xamarin Studio App Center

Xamarin Community Forum

Like any other technology, Xamarin has its own benefits and drawbacks, which have been a subject of a heated discussion recently. To make an informed decision about Xamarin vs native development, let’s weigh all the pros and cons of app development with Xamarin. If you’re really pressed for time, we recommend watching this video providing a high-level overview of the Xamarin platform’s strengths and weaknesses in under 6 minutes.

Pros and Cons of Xamarin DevelopmentPlayButton

If you want to get down to details, keep reading.

Pros of Using Xamarin for Development

There are good reasons why Xamarin is used by numerous companies, including Trello, Slack, and GitHub.

⊕ One Technology Stack to Code for All Platforms

Xamarin uses C# complemented with .Net framework to create apps for any mobile platform. Thus, you can share an average of 80-90 percent of the code across platforms speeding up the engineering cycle. Xamarin also does not require switching between the development environments: You can build all of your Xamarin apps in Visual Studio or Visual Studio Code. The cross-platform development tools are provided as a built-in part of the IDE at no additional cost.

⊕ Performance Close to Native

Unlike traditional hybrid solutions based on web technologies, a cross-platform app built with Xamarin can still be classified as native. As the platform develops, Xamarin performance is constantly being improved to fully match the standards of native development, with Microsoft giving advice on optimization techniques. Visual Studio also offers a complete solution for building, testing, and tracking the app’s performance: Visual Studio App Center allows you to run automated UI tests and identify issues before release. However, this service is provided at an additional fee.

Earlier, we tested and compared the performance of Xamarin and native apps. The results might be somewhat outdated; however, they clearly demonstrate the decent level of Xamarin apps performance.

⊕ Native User Experiences

Xamarin allows you to create flawless experiences using platform-specific UI elements. It’s also possible to build cross-platform apps for iOS, Android, or Windows using Xamarin.Forms tool, which converts app UI components into the platform-specific interface elements at runtime. As the use of Xamarin.Forms significantly increases the speed of app development, it is a great option for business-oriented projects. Yet, there might be a slight decline in performance due to the extra abstraction layer. For custom app UI and higher performance, you can still use Xamarin.iOS and Xamarin.Android separately to ensure excellent results. 

Traditionally, Xamarin is not believed to be the best option for apps with heavy graphics. That said, there are a number of libraries like OpenGL ES and frameworks like SkiaSharp and Urho that make development of apps with rich custom UI, complex animations, or games possible even in Xamarin.

⊕ Full Hardware Support

With Xamarin, your solution gets native-level app functionality. It eliminates all hardware compatibility issues, using plugins and specific APIs, to work with common devices functionality across the platforms. Along with the access to platform-specific APIs, Xamarin supports linking with native libraries. This allows for better customization and native-level functionality with little overhead.

⊕ Open Source Technology with Strong Corporate Support

After the company was acquired by Microsoft in February 2016, Xamarin licensing policies underwent radical changes. Xamarin SDK, including runtime, libraries, and command line tools, has become open source and available for all under the MIT license as a part of Visual Studio. By eliminating the major barrier, the cost of license, Microsoft paved the way for the further growth of the platform. Plus, headed by Microsoft, and supported by Unity, JetBrains, and Red Hat, the .NET Foundation in general and Xamarin specifically has become a reliable and powerful tech stack.

⊕ Simplified Maintenance

Due to its cross-platform application, Xamarin makes maintenance and updates easier. You can simply deploy the changes or updates to the source file and they will be applied to both iOS and Android apps. Thus, it helps you save time and money while keeping your apps up to date.

⊕ Complete Development Ecosystem

Xamarin comes in one package with a complete development toolset, including its own IDE. In April 2018, a lot of Xamarin development tools previously known as separate features became part of the Visual Studio App Center. Included is the platform itself (Xamarin SDKs), testing (formerly Xamarin Test Cloud), distribution and analytics (formerly Xamarin.Insights) platforms, and many more. Since the toolkit remains free, there’s no need to invest in additional tools or integrate third-party apps to build, test, and deploy your Xamarin apps.

⊕ Xamarin.Forms: a framework for creating native UI layouts

Xamarin suggests developers build mobile apps in two ways. The first one is to use Xamarin.iOS and Xamarin.Android, that appeared earlier and were originally considered more capable. Using Xamarin.Forms is the second approach. It’s a more advanced version that allows for rapid prototyping or producing apps with less platform-specific functionality. That’s why Xamarin.Forms is the best fit for apps where code sharing is more important than custom UI. It would let you reuse up to 99% of code, meaning that you’ll be able to create a single interface and share it across platforms without designing for each platform individually. You can also build applications where some parts of their user interfaces are made with Xamarin.Forms and the others are engineered using the native UI toolkit.

As Xamarin.Forms developed over the years, it became a universal tool and acquired a vibrant community that pays attention to it. For instance, some tech providers contribute their libraries like Telerik UI that enrich engineering capabilities providing pre-configured UI components.

⊕ Xamarin.Forms XAML Hot Reload

As Xamarin.Forms is aimed at fast and frictionless development, Microsoft suggests using a XAML Hot Reload tool. It speeds up development by letting you change XAML during debugging and immediately see those changes in the running app, without requiring you to stop and rebuild it. Moreover, your navigation state and data will be maintained, so that you can quickly iterate on your UI. This way, XAML Hot Reload allows for faster rebuilding and deploying your apps to validate UI changes.

⊕ Building apps for Macs with Xamarin.Mac Tool

Xamarin.Mac allows for developing fully native Mac apps using C# and .NET. It integrates with the same libraries that are used for developing in Objective-C with Xcode. By using Xamarin.Mac combined with Xamarin.iOS and Xamarin.Android, developers can share up to 90 percent of native code across Android, iOS, and Mac OS. Furthermore, Xamarin.Mac integrates with Xcode, so a developer can use the Xcode's Interface Builder to create an app's user interfaces.

⊕ Xamarin Learning Resources

Microsoft Learn is an online educational portal that helps people develop technical skills related to Microsoft products including Xamarin. The platform provides courses for both beginners and experienced engineers, allowing learners to prepare for Microsoft Certifications. Educational resources include free self-guided learning, live online classes, office lectures, and guest lectures.

⊕ Xamarin support of TVs, wearables, and IoT

The Xamarin framework, thanks to its Xamarin.Forms, enables building portable versions for many platforms. In addition to iOS, Android, Windows Phones, and Mac, you can develop applications for Tizen – an operating system used on some Samsung devices – for wearables, TVs, and IoT. Besides that, Xamarin.iOS allows for building applications for tvOS for Apple and watchOS.

Xamarin Cons to Consider

However, there are still some drawbacks that can cast a shadow upon the platform. So, why not use Xamarin?

Θ Slightly Delayed Support for the Latest Platform Updates

This depends completely on the Xamarin developer team. It’s impossible for third-party tools to provide immediate support for the latest iOS and Android releases as it takes some time to implement the changes and/or introduce new plugins, etc

Θ Limited Access to Open Source Libraries

Native development makes extensive use of open source technologies. With Xamarin, you have to use the elements provided by the platform and some .NET open source resources, facing both developers and consumers. While the choice is not quite as rich as it is for Android and iOS mobile app development, you can use NuGet Packages that now contain everything that was in the retired Xamarin Components.

Θ High Cost for Professional and Enterprise Use

Although Xamarin is a free open-source platform for individual developers, the framework may cost a pretty penny for enterprise needs. You will spend a lot to purchase a license for Visual Studio. For instance, Visual Studio Professional with the core set of development tools costs $1,199 for the first year and $799 for renewal. At the same time, a Visual Studio Enterprise, which enables experimenting with additional tools, will cost $5,999 for the first year and $2,569 for renewal. The features for both we cover below.

Θ Xamarin Talent Pool and Community Constraints

Obviously, the Xamarin community is significantly smaller than those of native iOS or Android. It’s also smaller than React and Ionic communities. Thus, finding an experienced Xamarin developer could be a challenge.

According to the 2020 Stack Overflow survey, only 5.8 percent used Xamarin framework as of 2020, compared to React Native’s 11.5 percent and Flutter’s 7.2 percent.

stackoverflow-2020

Usage of the Xamarin as compared to other frameworks. Image source: Stack Overflow

Despite the fact that the number of Xamarin engineers does not compare to iOS or Android native communities, the platform provides extensive support to its developers. As mentioned above, Microsoft Learn offers resources and practical training for those who are new to this technology. Using this support, the learning curve for an experienced C#/.Net engineer is minimal.

Another problem that some developers experience is the fragmentation and lack of standards in learning and development resources, including documents. This impacts the quality of support you are going to get.

Θ Basic Knowledge of Native Languages

When using Xamarin.iOS and Xamarin.Android to build mobile apps with truly native look and feel, you will still need to write a platform-specific layer of code using the native APIs of each platform. So, even though it’s not mandatory as it used to be, it would be helpful to have at least a basic knowledge of native technologies (Java/Kotlin for Android and Objective-C/Swift for iOS) is required to be able to understand and get the most out of the platform-specific documentation. Also, Xamarin.Essentials library provides multiple cross-platform APIs and can be used to access native features. This, however, doesn’t apply to Xamarin.Forms.

Θ Larger App Size

Depending on their type and complexity, Xamarin apps are typically larger than native ones (the latter might be half the size of a Xamarin app). A simple “hello, world” app for Android might take up to 16 MB, much of it being used by the associated libraries, content, Mono runtime, and Base Class Library (BCL) assemblies.

xamarin app size

Xamarin app size. Image source: developer.xamarin.com

So, Xamarin apps usually need additional optimization such as linking to remove the unused code from the included libraries and keep the app file size reasonable.

ΘXamarin.Forms Will Soon Cease to Exist 

In May 2020, the annual Microsoft Build conference was held. Among other news, it was announced that Xamarin.Forms is going to merge with .NET and evolve into a new cross-platform framework called .NET Multi-platform App UI, or MAUI. MAUI is going to have all native UI and provide access to all native APIs.

Also, as part of the gradual .NET unification, Xamarin.Android and Xamarin.iOS will eventually become part of .NET 6 as .NET for iOS and .NET for Android and will be updated to match other .NET workloads. The timeline for that is unknown yet, so stay tuned for future updates.

Meanwhile, the Xamarin.Forms migration should take place in November 2021. Once MAUI is released, Xamarin will be supported for another 12 months. So, if at the moment you are working with Xamarin or if you plan to build new Xamarin apps, it’s worth keeping an eye on the dates and looking for Microsoft guides for a smooth transition.

Θ Compatibility Issues with Third-Party Libraries and Tools

There might be some issues when integrating third-party resources with your Xamarin app. While most of the tools and libraries offer full support for native technologies, Xamarin support may not be provided by a vendor. Although Xamarin has its own components store, there is always a chance that you’ll need a specific capability or integration within your app that is not provided by the platform. So, to leverage other third-party packages you have to use wrappers.

Xamarin Visual Studio IDE

If you have a feeling that Xamarin is right for you, you’ll be interested to know the main Xamarin IDEs that can be used and how they compare with each other.

Visual Studio (VS) is a Microsoft Integrated Development Environment, or IDE, software used for building, debugging, and publishing applications across all platforms and devices. There are three main Visual Studio Versions for Xamarin – Visual Studio Community, Visual Studio Professional, and Visual Studio Enterprise. The key factors for choosing an acceptable version are the experience of developers (students or professional engineers) and their team size. Programmers can develop software for Web, mobile, server, and desktop with all versions. Learn more about Visual Studio in our article about the tools used for .NET development.

The latest version is Visual Studio 2019. In comparison with VS 2017, it contains numerous improvements that accelerate application development, from real-time collaboration using Visual Studio Live Share to the new Visual Studio start window. Also, it supports per-monitor DPI and improved debug capabilities.

The Xamarin workload is now reduced by about 3 times from previous versions, meaning reduced from 23 GB to 7GB. It drastically drops disk impact and accelerates installation. Additionally, the new release made considerable improvements for Android SDK and emulators management. It also made major efforts in strengthening UI authoring. This includes Xamarin.Forms improvements with IntelliCode for XAML, AXML-enhancements for Android, upgraded Xamarin iOS Shipping, and many other features.

Visual Studio Community is a good fit for students, open-source projects, small development teams with up to 5 users. The Community package is also good for teams that are new to Visual Studio. This version is free for use.

Visual Studio Professional is a set of tools and services created for professional developers, small teams, and enterprise use. This version provides powerful features to quickly understand your code: showing code references, changes to your code, displaying who last modified a method, or discovering whether tests are being passed. The professional version includes Azure DevOps which is a collection of features such as agile project planning and testing tools, CI/CD pipelines, reporting solutions, and more. The annual price for this version is $ 1,199.

Visual Studio Enterprise has stronger support tools and services. They allow for managing more complex processes between development and IT operations; tracking quality with manual and automated testing tools; getting access to professional training and the entire Microsoft engineering and testing ecosystem. The Enterprise Version also has priority support, partner offers, and much more. The annual price for Enterprise Studio is $5,999.

For enterprise use, we also recommend checking the Visual Studio App Center. It’s a tool that organizes app development workflow across different mobile technologies including Xamarin. Here, engineering teams that work on multiple apps can bring their toolset together. It automates app packaging through GitHub or Bitbucket, provides integration for different testing services, enables email app distribution for testing, does crash tracking and analytics.

Visual Studio Code, or VS Code, ranked as the most popular development environment in 2019 with 50.7 percent of developers reporting to use it. VS Code is a free, lightweight open source code editor that provides all the main tools necessary for a simple cycle of code editing, building, and debugging, but lacks the capabilities of the full-featured IDEs that allow for managing more complex workflows. It runs on Mac, Linux, and Windows, and supports such basic development operations like task running, troubleshooting, and version control. It also has IntelliSense for AI-assisted development, works with GitHub, and has a rich ecosystem of extensions. VS Code is fast, simple to use, highly configurable, and can be a good choice if you need something lightweight, but with good functionality

Visual Studio Online, or GitHub Cloudspaces, is a browser-based development environment that supports VS 2019 and VS Code. It is now only available in beta and has limited functionality

Switching from Android Studio or Xcode to Visual Studio

If your development team considers transitioning from Android Studio (AS) or Xcode to Visual Studio, the learning curve won’t be that steep. The feature-to-feature comparisons show that the IDEs are very much the same in terms of development flows with little nuances for each of the environments.

From Android Studio to Visual Studio. While Android Studio official support is focused on Java, C/C++, Kotlin, and XML languages, VS supports all major programming languages including those of AS. This is due to the wide spectrum of platforms that IDE caters to. VS provides more engineering freedom and allows for working with different projects from one environment. If you’ve been using the Google Cloud Platform integrated with AS to run virtual machines or just manage projects, Google is kind enough to provide its cloud platform extension for VS as well. Basically, you can use both the Microsoft cloud ecosystem and Google Cloud right from VS.  Visual Studio can be installed on all main platforms: Windows, Android, Mac OS, and Linux.

From Xcode to Visual Studio. Xcode IDE, similar to VS, supports source code for all major programming languages. So, there won’t be any surprise after transitioning. Again, if you’ve been tied to Mac OS while using Xcode, Apple hardware isn’t needed for VS. For those, who use CloudKit for server-side storage, Visual Studio and Xamarin allow for simple integration of CloudKit. The main drawback of using VS compared to Xcode is it's price: Both Android Studio and Xcode are free to use while VS requires a pretty high subscription fee.

According to developers’ estimates, Visual Studio and Android Studio, both, have mostly the same ease-of-use level and support quality. Comparing the same indexes with VS and Xcode, we can say that VS estimates are a bit better. Also, Visual Studio is more popular among enterprises (>1000 employees) while about 50 percent of Android Studio and Xcode users are small businesses (50 or fewer employees).

Considering Strategy Analytics ranks on mobile development environments, Xcode achieved the highest ranking on testing capacities as did Visual Studio. Android Studio lagged behind. Total scores were: Xcode-22; Visual Studio -21; and Android Studio -13.

Considering Other Options: Xamarin vs Hybrid Development vs Native iOS/Android vs Other Cross-Platform Frameworks

Recently, many developers tend to agree that Xamarin can be considered “native” development tool. Indeed, there is an opinion that “anything that can be done in an iOS application using Objective-C or Swift, and anything that can be done in an Android app using Java, can be done in C# using Xamarin.”

Yet, there are many pitfalls in the native vs Xamarin debate. Let’s see how Xamarin compares to the native development tools and hybrid development platforms (Ionic, PhoneGap/Cordova).

Xamarin vs Native vs Hybrid Development

Xamarin vs hybrid vs native development in a nutshell

Although hybrid mobile development tools are evolving quickly, they still lack the performance and native capabilities that Xamarin offers at roughly the same cost. However, the shorter time to market remains their main advantage.

As for choosing between Xamarin or native iOS/Android, you have to consider the available time and budget (native development is usually more expensive and takes longer) and the type of app. If you need high-end performance and a perfectly adjusted UI, it’s worth going for native apps.

As more cross-platform frameworks emerge and develop, it becomes harder for Xamarin to keep its position in the market. Today, a number of frameworks have already outpaced Xamarin in terms of popularity and performance. React Native was voted the top choice of 2020, closely followed by Flutter.

statista-cross-platform-frameworks-popularity

Cross-platform mobile frameworks usage dynamics. Source: Statista

Every cross-platform app framework features different functionality and structure. To get a better picture, check our comparison articles: Xamarin vs Flutter and Xamarin vs React Native vs Ionic vs NativeScript. The latter, for instance, despite being less popular, would be especially valuable for those developers who use Angular framework as they are closely interconnected.

Piece of Advice

When comparing the pros and cons, the listed drawbacks are usually considered to be a collateral damage. Most business owners choose Xamarin mobile app development platform as it decreases the time to market and engineering cost, by sharing the code and using a single technology stack. Yet the purpose of the app and its target audience might be an even more important factor to consider.

Based on our team’s experience, the best use-case for Xamarin is enterprise mobile solutions. With standard UI which covers 90 percent of the projects, all the core product logic can be easily shared across the platforms. Hence, platform customization will only take 5-10 percent of the engineering effort.

In case of consumer-facing apps with heavy UI, the amount of shared code decreases drastically. Thus, Xamarin cross-platform development loses its major benefit and might equal in time and cost to native solutions.

This article is a part of our “The Good and the Bad” series. If you are interested in web development, take a look at our blog post on the 

The Good and The Bad of Angular Development

The Good and the Bad of JavaScript Full Stack Development

The Good and the Bad of Node.js Web App Development

The Good and the Bad of ReactJS and React Native

The Good and the Bad of Swift Programming Language

The Good and the Bad of Selenium Test Automation Tool

The Good and the Bad of Android App Development

The Good and the Bad of .NET Development

The Good and the Bad of Ranorex GUI Test Automation Tool

The Good and The Bad of Flutter App Development

Comments24

Sort by