The minute my daughter was born I realized that TV sold a lot of hype on how babies look when they first come out; I stood there as a young 20 year old with my jaw dropped; she was all purple, yucky looking, and my first reaction was “put her back! she isn’t done yet”. Well it turns out she was done and grew up to be a beautiful young girl and lady – so perhaps that is the moral to this story?
Day one with Xamarin was a wasted day of my life, I’m putting it back because it doesn’t feel like it is done yet, I’ll try again at the end of the year. Perhaps I should have waited longer? In my last correspondence with them a little over a week ago they indicated that in a couple of months they will release a “starter” edition that includes Visual Studio integration, but I should “dabble” in the current version until then. This was in response to my request to have a version (like Microsoft Visual Studio) that would allow a developer to learn how to use their system without having to spend $900.00 up front (only Xamarin business edition supports Visual Studio integration); I indicated to them that there is no return on investment (ROI) and it is not in my budget.
A prerequisite for any Microsoft Visual Studio developer that wants to start dabbling in Xamarin is Jim Wilson’s webinar on “making cross-platform mobile apps with Xamarin and C#”. This webcast goes a long way to answer a lot of questions that I had coming out of the gate in regards to the environment, although I must admit I only made it half way through because I was anxious to get started and my SamSung slate just reported a successful install of Xamarin.
The adventure follows:
My first mistake was downloading the following two applications off of the main page:
This is what kicked off most of my days efforts – I didn’t have an emulator so I couldn’t run anything.
This adventure assumed a lot of knowledge on the part of the Microsoft developer, you have to know how to add an emulator. When I first went into the Google Emulator Manager (from Tools menu) and created one it complained that there was not a CPU/ABI – some Bing research on this revealed that I had to add an image….
This eventually led me to the Android SDK Manager, between it and the Project Options (comparable to Project Properties for Visual Studio projects) I started to tie things together…
Xamarin Projects are tied to API versions on the options | Build | General tab. The “Tasky” project that I was actually able to load and run in the emulator had two emulators “MonoFor…(API 10)” and “MonoFor…(API 12)” as shown in the bottom right pane of the image below. In the case of Tasky project it was using Android 2.3 (Gingerbread).
So through a process of elimination I installed the Android 5.0.1 (API 21) images shown below (under status column) which allowed the Emulator to load. I had to use the process of elimination because I only had 10 gig available on my SamSung slate (64 gig drive) and these images quickly consume gigabytes of drive space – first efforts failed after a very time consuming download process because it filled up my drive.
After hours worth of research, trial, error, and work I didn’t even get to see the emulator run…. I created a new Android 5.0.1 project, set the emulator and as you’ll see below a brand new project exceeds the “free” license size and I have to have indie edition or higher to use it… Indie is affordable but it doesn’t support Visual Studio and you can’t create Windows Phone applications in Xamarin (only VS) – so all of the constraints mean that only the Xamarin “Business” edition is feasible which has a $899 price tag which is not feasible without a ROI.
BUT I WASN’T READY TO GIVE UP – I wanted to see how it worked so I started browsing the code, I was curious how MVVM worked in this framework. I started with the Login screen which had a ViewModel in a different project, I quickly saw that it uses the MVC/MVP Passive View pattern (see How it Works) in that the controller, LoginActivity class, is responsible for updating the view model; the view is not using the Observer Pattern (data binding).
I thought perhaps this would be different with a XAML view but when I added one the compiler complained and by this time I was done chasing issues so I simply deleted the XAML page. BTW, it took me a long time to figure out that the Views are stored in the Resources\Layout folder with the code-behind (for a lack of a better word) residing in the root of the project.
BUT I STILL WASN’T READY TO GIVE UP, I wanted to see something run… As I eluded to above I was able to load and run the Tasky project so I started dabbling with it – in all of its older version limitations….
So I loaded Tasky, was glad to see the emulators, clicked run and 3-1/2 minutes later the emulator was loaded and running the application. No carpel tunnel problems here, plenty of time to rest/recoup. I got curious and timed myself getting a cup of coffee from my Kuerig machine, making toast, putting the butter back in the fridge after buttering my toast and getting back to the office – walla! 3-1/2 minutes. At least I can spend this time productively :)
But I was thinking, I can live with this for the ability to develop multi-platform…. So I loaded the view and was a wee bit disappointed in the available controls and design time experience. Visual Studio WinForms and XAML really have us spoiled… So I make a few updates to the screen, learned that I have to use a TableLayout (much like a Grid in XAML) and clicked run on the emulator. It compiled and then …..
CRASH - the following was the only clue to the problem, the compiler was a happy camper and blindly handed the app off to the emulator. The emulator didn’t like something….
It was becoming clear that you get what you pay for in the Android/IOS development world. I trust that experienced developers in these environments would know what to do but as a newbie (experienced Microsoft) developer it is a miserable experience because we are use to having stuff just work. If I add a project and hit run – it just works, doesn’t matter if it is Windows Phone, Tablet, Desktop, Web, or console. The emulators rock!!
So I’m sticking a fork in it for now – we’ll see how far things progress. I trust with Microsoft and Visual Studio in the scene we experienced Microsoft developers should be able to feel more at home and have things just work…
You can emulate the development experience if you create a Portable Class Library (PCL) project in Visual Studio (which has no WinForms or XAML support) and put all of your shared code in it (this is all you can share); PCL is a subset of .NET which has less features than Silverlight does.
The PCL concept is used for Xamarin development in that you create a Portable or Shared library for the code you will use between platforms, but all of your UI logic has to be done in the Android or IOS project (at least for Xamarin Studio).
Xamarin Studio does not support IOS for Windows, you have to use OSX (a Mac), likewise it does not support Windows Phone so it is pretty much useless unless you are doing Android development.
Visual Studio reportedly will support Android, IOS, as well as Windows Phone development, however after installing Xamarin successfully Visual Studio 2015 preview had no clue Xamarin was installed – so I was forced to play in Xamarin Studio.
It was truly an adventure….