I wanted to try F# in Xamarin Studio since it’s a first-class citizen there which is pretty awesome! A pleasant surprise was that I would receive a free F# t-shirt in three simple steps (my father has always said that nothing is free but that’s another story). However, turned out things wasn’t as as easy as expected, at least not for me. These were the steps that I had to do to get it to work on my Windows 8.1 machine:
2. Download the F# Xamarin Store app and open it in the Xamarin Studio
3. Make sure the right version of fsharp.core is installed. At the time of writing Xamarin Studio requires version 18.104.22.168. This version can be installed through the F# tools for Visual Studio Express available for download here.
4. Now, the Android project won’t compile since it requires the System.Reflection.Assembly type which in turn requires the so called Indie license. Too bad it’s a non-free license (my father’s voice echoed in my head at this point). Good thing there’s a 30-days trial version of it though! So just go on to the Xamarin login site and create an account.
5. In Xamarin Studio you can now login to your account through the Tools menu and activate the trial.
6. After this the build should work but when running it (right click the Android project -> Run item), at least for me, showed two emulators both incompatible with the project due to too low Android SDK versions so step 7 is:
7. Open Tools/Android SDK Manager and download/install Android 4.4.2, API 19 (not sure exactly what version is required).
8. Open Tools/Android Emulator manager and create a new Emulator based on the above API. Start the emulator!
9. Go back to the project and find the file Fragments/LoginFragments.fs and replace email@example.com with your registered email address on the line
let xamarinAccountEmail = Some "firstname.lastname@example.org"
10. Run the app (right-click XamarinStore.Droid and Run Item) and select the newly created emulator as target. When the app starts just follow the instructions to get your well deserved F# shirt!