Moving – Xamarin (C#) Vs Kotlin

Somewhere around 2018, I had my first encounter with Kotlin and Android Studio. It was not as pleasant and probable it makes me even love more C#.

But it’s 2020 and one of my apps is gaining some traction on the Google Play Store, but many comments are related to the size of the App and overall performance.

So last week I decided that I wanted to port my Baloto Random App form Xamarin Forms to full Kotlin Android.

The app is basically a random chooser number for a Lottery Game and it also parse some data from the Web and from Json to show user data related to the results.

So the arquitecture is quite simple.

With the idea in mind to keep the same services, and the same features I started porting the App. To give you some idea, I been programming in C# for about 3 Years. And about 8 days in Kotlin.

So it was going to be a really big challenge.

I know, I know, that C# and Kotlin may have some similarities but for me, it’s like a blank space.

The Pros.

Android Studio was very easy to install on my laptop.

The XML structure of the Views in Android Studio is very similar to the one in XAML so, the porting of the view took me about two days, Yeahh two days. I am not familiar with constrain Layouts and Grid was not an alternative since they are deprecated now.

The whole Gradle implementation thing is just like using the NUGET packages so that was fairly simple. I do like the NUGET graphical front-end.

The simple code and the refactor from Android Studio is just amazing, there is a similar extension for Visual Studio.

Doing simple code like math code and other related to the views was simple.

The app looks more beautiful on the Android Studio.

Stackoverflow has plenty of things related to Kotlin.

Services like Firebase Analytics, Firebase Message, Admob are more simple to use on full Android. Not the Maps, that is simple on C#

The App size is just wonderful: I was reducing app size release by release, but could not get down from 8.7 Mb (Xamarin Limitation), now the app size is just 3.2 Mb and I’m not using full R8

The new features for Android Studio make me able to use the new UPDATE Manager, and new stuff from google

The Cons.

I do love MVVM, I think it keeps code in good shape and it makes it simple to read and to test. The whole live data and the Live Cycle of the fragments and activities is really complex when you are too familiar with bindings and view models in C# (I did not use MVVM since I need to study more to understand how it works on Kotlin and Android)


Await and Async is not so simple, coroutines are well explained in the Kotlin documentation but let’s be honest C# is miles ahead on this front. I did manage to use async functions but it took me about 3 days to understand the concept and the code.


Google documentation is not as good as Microsoft Documentation, and this was a pain in the ass, I tough that it would be more complete, but no.

I could not find any good DOM parser so I had to change the whole architecture of my app to using some CSS query to extract some data from a Website that I used to do with Xpath. This was the most difficult part of porting this App, there is no good documentation on XPath or CSS scraping.


Overall it was a good experience, I wanted to do the whole porting thing in five days and it took me eight, mostly because services were not easy to implement as the way things work are different. I did learn a lot and I could probably continue learning, but this year the idea is to learn other stuff so I think for a demo or preview was very nice.

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *