Xamarin.Forms, Genymotion, and some other cross-platform notes

From the Xamarin Evolve conference a few weeks ago, I was re-intrigued to dig back into Xamarin. I have a project which I’d like to release on all platforms. However, I ran into several stumbling blocks, made of molasses – which eventually discouraged me. It was really two main issues: 1) dealing with UI’s on different platforms – it gets tedious and 2) dealing with databases, which I’m currently using SQLite. I’ll address the 2nd point in a future post (maybe Azure Mobile Services??). As for the UI issues…

Overall, I feel I DO have some things, totally dialed-in with cross-platform development. For example:

  • Using a portable class library for as much logic as possible. For any device specific things (camera, gps, etc) – create an interface.
  • Use a platform-specific class library, which references the PCL to implement any platform-specific providers (camera, gps, etc)
  • Dependency-inject all of your external dependencies in the main loader for the app

This works extremely well! You can unit test just about all of your code, you have maximum code re-use, every thing is in it’s place – except for the UI.

Enter Xamarin.Forms:
I saw that the legendary Charles Petzold wrote a free e-book on Xamarin.Forms. I had an idea what this was, but I didn’t dig into it, until tonight when I skimmed through the book and followed the samples.

What it is, is basically defining the UI entirely in code. There is no UI designer, and there is not even any XAML. You write code for all of the UI elements you want to use – and that includes the MVVM bindings you’d want to use. It’s a LOT of code – but the upside is that it’s in one place for all platforms (iOS, Android, WP, etc).

My verdict, as of this writing, and as of this version of Xamarin – is that I won’t pursue this technology.

I feel I understand the value, and it is a big step forward, but it’s still a lot of code. Plus, arguably, if you wrote your code like I mentioned above – with almost all of it in a PCL, there would be very little code in the UI anyhow. It should pretty much just be layout and MVVM bindings. That to me, is pretty reasonable.

How to do cross-platform, as of this writing?
For me, I think I will continue doing what I was going. The missing bullet point from above is:

  • A platform-specific project which uses the platform-specific class library, and the PCL. It simply sets up the UI and binds with MVVM.

Unless or until they make Xamarin.Forms a little easier, I think this path is pretty reasonable. I think I just need some fresh eyes on it.

Write which code, where?
One thing that is kind of awkward about Xamarin is where some code can run, and emulators:

  • Mac OS has emulators for iPhone and iPad, and can run Android – but can’t run anything Windows.
  • Windows has a Windows Phone and Windows emulator, and can run Android VERY slowly – but can only run iOS over the network, if you also have a Mac – and have the full business license of their product (which is not cheap!).

Bottom line, there is no single computer where you can do all of your development, you MUST do your coding on different machines. I wanted to get a better handle on this.

Enter Genymotion:
One thing I’ve heard about is Genymotion. They have their own (free) Android emulator which runs out of VirtualBox. It supposed to be much faster than the Android Development Kit (ADK) emulator. I installed this on Mac OS X Yosemite – and it is quite fast! It launched in well under a minute, plus the UI is responsive.

Here it is on Mac:


I tried the same thing on my main Windows 8.1 machine and sadly, it is waaaaaaaaaaaaaay slow.

Here it is on Windows 8.1:


Not only did it take 10+ minutes for the Android OS to boot, the UI is super choppy and slow.

What’s the answer?
I guess the conclusions I draw from tonight’s experimenting are the following:

  • I’m not going to use Xamarin.Forms for any projects right now – but I will definitely see what they add with each new release.
  • I am going to keep using the PCL approach, as that is a very elegant way to do cross-platform with maximum testability and maximum code reuse.
  • I will use a Windows computer to do the PCL, Windows Store and Windows Phone development.
  • I will use a Mac computer to do the iOS and Android development and testing.

But wait, I don’t have a Mac!
A really great option which has worked out very well for me is to buy a Mac Mini. Even a brand new one is only $499. On ebay or used on Amazon, you can get one that is a few years old for a couple hundred bucks. Put an SSD in it – and go to www.crucial.com and max out the memory in it. I have a “late 2009” model which more than suffices for what I need and it can run the latest OS.

As far as connecting to it, I have found that VNC to be pretty much unusable – but you can download www.teamviewer.com for free and set the computer to run in “unattended mode” which means you can connect remotely (very similar to RDP) and do your work either in full screen or in a window!


So there you have it, that is a inexpensive way to get access to a Mac.

Posted in Apple Stuff, Cloud Computing, Computers and Internet, Development Tools, General, Infrastructure, Mono, New Technology, Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Enter your email address to follow this blog and receive notifications of new posts by email.

Join 9 other followers

%d bloggers like this: