One of the more exciting things from the recent Build conference was the frequent mention of Xamarin. Whenever Microsoft noted its embrace of cross platform, there was Xamarin providing the capability:
It seemed that every .NET-oriented session mentioned Xamarin, and Miguel de Icaza, CTO of Xamarin, made an appearance in the Day 2 keynote and gave an excellent presentation, Go Mobile with C# and Xamarin .
I played with Xamarin a bit last year, and although there were some rough edges, I thought then, and still do, that it has great potential. C#, .NET, Android, iOS? What’s not to love? As de Icaza noted, people expect great experiences from their mobile devices and “C# fits like a glove for mobile development”. It’s been about 6 months since I last took a look, but since I really wanted the “snazzy” C# t-shirt seen at Build, thought I’d give it another spin.
Not that there still aren’t rough edges.
Hmm, was my account no longer valid? Nope, my credentials still worked on their web site, and I was able to download the latest installer from there.
Since I don’t have a Mac, I haven’t yet tried out Xamarin.iOS. A Xamarin.Android install will also install the Android SDK, Xamarin Studio, and the Java SDK and Android NDK if not present. So it can take some time. The installation completed with this message:
Great, except I’m running VS2013. Thankfully it was just a bad message, and Xamarin.Android 4.12 installed OK.
But, ah, I still got the same error when trying to login to my Xamarin account from VS. Since I couldn’t get past the error in VS I switched over to Xamarin Studio. Xamarin Studio is a nice IDE, but a bit of a step sideways after VS. It is improving though; I found that some of my favorite shortcut keys which hadn’t worked in an earlier version were now working.
There’s a Xamarin Updater built into both the VS tooling and Xamarin Studio and I’d previously set it to automatically check for and download updates from the “stable” channel, so this popped up when I opened Xamarin Studio:
After this, I was finally ready to open the XamarinStore app, the sample application shown at Build which introduces you to Xamarin and gets you the snazzy t-shirt.
Just press “play”.
Building the XamarinStore sample application requires that you login to your Xamarin account:
Xamarin comes in several editions, and I’m currently using the Business edition from my former employer but will soon switch to the free Starter edition. Unfortunately that means no more VS integration.
You’ll need to rebuild after successfully entering your credentials. Also be sure to check the Tasks window for TODO items Xamarin has left for us.
If you haven’t started and selected an emulator, you’re prompted with a list of device emulators. If you’re not up on your Android API levels this will appear confusing, and reminds you that there is a learning curve to developing with Xamarin.Android. The Android developer documentation is a good resource and they’ve helpfully mapped API levels to platform releases.
I chose level 15 (Ice Cream Sandwich) since Jelly Bean and KitKat device emulators weren’t listed. Afterwards I found that although the Android SDK had been updated with my Xamarin installation, the packages for these API levels weren’t also automatically installed. I’ll have to do that later using the Android SDK Manager:
You can also view and edit the devices using the Android Emulator Manager available from the Xamarin Studio Tools menu. (The actual window opened is called the Android Virtual Device Manager.) The size of the emulator screen made using the virtual keyboard difficult, so to add keyboard support I had to edit the AVD to add it:
There’s much to learn in Xamarin, and their Developer Center has a lot of great content. I hope to dig in deeper soon.