Just recently I have published my first Xamarin app. I have developed apps already before using Java and hybrid code in HTML and JS as well. This is just a simple app that retrieves data from a server that is the list of events from a scrapped data I got from a certain website. This is not for client since this is just a pet project so the purpose of this is to display all of the upcoming events or gig. Here I used the native setup or also known as Xamarin.Android. It would I have be better if I used Xamarin.Forms to be able to publish in Windows and IOS however I only have an Android phone and I don’t have a Mac. But the code is somehow similar since they both use the C# language as well.  So this is just to share my experience and recommendations in developing using these tools.

Just a little detail for those who are unfamiliar with Xamarin. Xamarin is a software company that provides tools for cross platform development using the .NET Framework. Their primary IDE is Xamarin Studio (Formerly MonoDevelop) and this installs also in Linux (although the Mobile development tools are only available in Windows and Mac). Just recently Microsoft acquired Xamarin so now they provide a plugin that would enable using Xamarin tools with Microsoft Visual Studio.

So in the development of the app, I used Microsoft Visual Studio Community Edition along with the Xamarin plugin. What’s great with this is since it is community edition, you can get it for free. Yes as in free root beer! You will just need to register the software online for both Microsoft and Xamarin which will only take for a few setups before starting.

I had a good time with using Xamarin tools, though there are still some unpleasant time but that’s part of programming since this also happens to other platforms. Here are some of the good parts and not-so-good parts.

The Good Parts

The IDE

Yes Visual Studio, despite of being a bit bloated in your compluter memory, work with a powerful award-winning IDE. This has come a long way even when it was a simple IDE of Visual Basic back in the Windows 3.1 era. You can also use Xamarin IDE as well although there are some things it lack such as the lazy property generator with just a few keystrokes.
Microsoft Visual Studio also comes with various development tools such as the NuGet, a package manager similar to npm or gem in other development platforms that enables you to download and manage 3rd party libraries. There is also an integrated version control system which is great since I don’t need to open Git to make commits. It’s like everything is there in the IDE so there is a reason for it to bloat a bit.

C# is Awesome

C# is Awesome
Yes it is (photo taken from Devcon 2016 Xamarin talks)

There are a lot of great things is C# especially in the code. Features like Linked Queries (LINQ) a high level way of searching through a collection using code similar to SQL, and properties, operator overloaded event handling (C# uses the += along with a fat arrow function approach of attaching events which is much simplier compared to Java).

What’s also great about C# is that even though I used Xamarin.android, most of the code such as syntax rules such as event handling can still be applied when developing in Xamarin.IOS or Xamarin.Forms. This minimizes the effort of learning another language just to develop for different platforms.

The Not-so-good Parts

Kind of Buggy

This is something that can be expected from a third party software rather than using tools that Android has provided. There are times when trying to deploy the app to the emulator, the process takes a long time. Which sometimes it never finishes and I have to break the operation. There seems to be a deadlock happening during the process.

I would also experience a build error that would sometimes show for no reason then disappear. And there are times when building I would need to uninstall the deployed app in the emulator then redo the process. But I think this part is also experienced by those who used Java as well.

Declining Support in Xamarin Native

Most of the community is moving to Xamarin.Forms, a much more flexible approach to developing to multiple platforms. Though this is new, and unstable, it is recommended to move there. The main reason I just used Xamarin.android as I’ve mentioned is because I don’t have any other devices to use. But if you will check some of the code is almost the same since both are using C# and Mono runtime. Even the libraries are also applicable.  I think Xamarin.Forms is Microsoft/Xamarin’s answer to React Native, a tool that allows developing native applications in both Android and IOS using the JavaScript language.

The Set up

I think most of the development time I spent for the app was trying to set up the environment. There are times that upon updating the tools, the project won’t work because you will have to do some configurations and update to the Android SDK as well.

Also there seems to be a problem when running the emulator. Whenever I am using other android IDE’s such as Intellij IDE or Android Studio, when you run the application, it automatically detects if there is already a running emulator and you can configure where to deploy the app. In Visual Studio, there is a simple configuration for selecting the emulator. However, let’s say I have a Nexus emulator running I have just executed using the Android Virtual Device manager, then I ran the project, Visual Studio will spawn another instance of the emulator even though I have selected the target. There are also times when even the emulator was launched by VS, then you terminate the deployment halfway, the next time you run the app, it will also spawn another emulator. I think the IDE needs to establish some sort of handshake with the emulator. Not much of a bug but can be a hassle sometimes.

Just a minor thing but building your app adds an additional 6MB bloat especially if you are just developing a simple app (normally it would take you about 1MB if you use Java). This is not that big if you have fast internet connection unless you target places with slow (and expensive) internet connection

Conclusion

So then I decided not to use Xamarin for my next project or perhaps for the moment. This is just a personal choice though since I would like to use Java instead. I would still recommend it for those who would like to develop their mobile apps and have solid knowledge in C#. Despite of having some problems in development, Visual studio with Xamarin tools is still a great in developing mobile applications and support is always there with the community so I might recommend using Xamarin.Forms as well if you happen to start using Xamarin.

Leave a Reply

Your email address will not be published. Required fields are marked *