I’ve been wanting to dig into using Xamarin to do iOS/Android development in Visual Studio/C# for a while now. So finally had a chance to start looking into it closely.
Update: After you read this post, checkout the follow up.
I now have everything setup and running. I must admit that creating my first Android and iOS projects was not as a satisfying has I had hoped. There’s a bit of flaky behavior in the Android UI designer and the wizard generated projects for both Android and iOS have problems.
Let’s look at the Android side of things first.
The initial problems I ran into were tied to unexpected UI designer behavior I encountered when it was first opened.
- The “Alternative Layouts” button, which is a really cool feature that lets one manage different device layouts more easily, didn’t work at all. Clicking on it did nothing.
- The other buttons across the top allow one to manage the UI layout in different environments. As you can see some of those buttons are too small for their labels. There also some missing.
- I was expecting buttons on the bottom-left of the designer to allow me to toggle between the design-view and the XML-view but they aren’t there.
- Finally the label of the button on the device design-surface is showing the name of the string resource ‘@string/Hello’. It should be displaying the actual value.
The first two issues are easily resolved by simply taking some action that causes the design window to resize: explicitly resizing it, hiding/showing the toolbox, etc.
It turns out that the design-view/XML-view toggle buttons are not supported for VS2013 in the current stable release of Xamarin.Android (4.10.1), although they are supported in earlier VS versions and in Xamarin Studio (Xamarin’s stand-alone IDE). I checked around and found that the beta version of Xamarin.Android 4.10.2 does include support for the toggle buttons so I decided to install the beta.
When I installed the beta, it did indeed add the toggle buttons. It also fixed the first two issues I mentioned BUT …
… it completely broke iOS support in Visual Studio 2013 (we need to keep in mind that Xamarin.Android 4.10.2 is still in beta). I could no longer open or create iOS projects (remember it’s Android support that I updated). Unfortunately reinstalling Xamarin.IOS did not fix it. I ultimately had to completely uninstall all of Xamarin then reinstall from scratch and live without the toggle buttons for now.
Moving on from the Android UI designer for a moment, I also ran into problems with the wizard-generated Android project in that it’s naming the Android resource folders incorrectly.
Notice that the folders under Resources (Drawable, Layout, Values) are all capitalized. That’s not supposed to be the case [ excuse the pun ]. The Android platform doesn’t like that. Those are supposed to be all lower-case. I had to go through and manually rename them. Not ideal but not the end of the world.
BTW: Fixing those folder names had a nice side effect: It resolved the problem with the string resources. With those names fixed, the string resource values now display correctly on the device design surface (thanks to James Montemagno at Xamarin for his help on this one).
You can follow the steps I went through working things out on the Xamarin Forum.
After working through all the Android stuff I setup all of the iOS pieces which include setting up a Mac as a build server. The setup process went pretty smoothly. I then ran the wizard to generate an iPhone Hello World app, did a build and immediately got 2 build errors and 1 build warning.
And with that I’m calling it a day.
I must admit, I expected an unchanged, wizard-generated project to be error free.
To not blow things out of proportion, we want to keep in mind that none of the issues I’ve mentioned are show-stopping. They’re basically annoyances and all fairly easily worked around.
We don’t want to lose sight of the fact that Xamarin is solving a very hard problem. Android and iOS are incredibly different platforms with many of their own nuances and complexities. Then on top of that, Xamarin has to integrate into Visual Studio (a complex IDE) and interact with the iOS toolset running on a Mac. Many, many challenges to overcome.
Working in a brand new environment is always a bit stressful. For me, the best way to have that stressed relieved is for the environment to all work smoothly which didn’t quite happen in this case. That said, I have a workable environment and although I do need to apply some workarounds, they are all fairly easy to deal with.
I’ll dig back into things tomorrow.
Update: I’ve posted a follow up to this post.