Setup Mono for Android on Windows - Tutorial
After a short (3 weeks) adventure with
Windows 8 I’ve decided I don’t want to struggle with the system (nor
constantly switch back to ‘Desktop’ mode after another accidental switch
to ‘no-longer-called-Metro-UI’) and so I came back to well known,
liked, cozy Windows 7 x64. This is the system I’ve been using at work
for a little more than last 3 years (basically since day one it RTM-ed)
and the one I split time when developing at home - 50/50 with Mac OS X.
I’m a convert from iOS church to the Android - the mobile OS that
brought me to my knees with Samsung’s Galaxy S III (I’ll post about it
on another occasion). And so I wanted to get at least a little bit
familiar with developing for Android, however I wasn’t that much
enthusiastic when I thought about a perspective of switching development
environment to Eclipse and programming language I use on daily basis to
Java. Fortunately Xamarin offers the
tooling that allows developers to develop for Android (as well as iOS
and Mac) using C# and Visual Studio (as an option).
Note: The best thing you can do is to head over to Xamarin - trials and after registering - run the setup. Mono for Android installer should automatically detect which of the prerequisites are missing from your system. However in my case (and as Google search results show I’m not the only one) - this didn’t work. Also - you need to have a paid version of Visual Studio (Express edition won’t suffice as it does not support 3rd party extensions). I also think - following step-by-step guide gives you a better understanding of the pieces of the puzzles involved, than clicking ‘next’ a few times in the installer
So here are the steps required to configure Mono for Android on Windows, with Visual Studio, to enable developing for Android mobile devices in C#:
Next, based on this device - create your AVD, mine looks like that (Note:
if later on, when trying to run your application on AVD - when it fails
- change RAM size from 1024MB to 512MB - I haven’t figured out why, but
it seems like AVD is unable to boot when setup with more memory than
512MB - and Visual Studio fails silently - waiting forever for Virtual
Device to boot up):

After the project has been created hit ctrl+shift+b to build the
solution. If everything is installed and properly configured, you should
end up with an output log similar to this one:

Here are some materials to get you started: Mono for Android Tutorials and Guides for free, or should you prefer the book and have some dime to spend - Professional Android Programming with Mono for Android and .NET/C#, happy coding!
Note: The best thing you can do is to head over to Xamarin - trials and after registering - run the setup. Mono for Android installer should automatically detect which of the prerequisites are missing from your system. However in my case (and as Google search results show I’m not the only one) - this didn’t work. Also - you need to have a paid version of Visual Studio (Express edition won’t suffice as it does not support 3rd party extensions). I also think - following step-by-step guide gives you a better understanding of the pieces of the puzzles involved, than clicking ‘next’ a few times in the installer
So here are the steps required to configure Mono for Android on Windows, with Visual Studio, to enable developing for Android mobile devices in C#:
- Download Java Software Development Kit 6 Java SDK 6 - do NOT pick x64 version (even if you are on x64 version of Windows), go for x86 version. Also for Mono for Android 4.2.5 - that’s the one I’ve been using - Java SDK 6 is required (it won’t work with JDK 7 - although you can have both installed on your system side-by-side)
- Download Android SDK - click on the ‘Download SDK Tools for Windows’ (ADT Bundle includes Eclipse, which is not the option I wanted to go for)
- After Android SDK is installed Android SDK Manager will run. This allows installing different APIs (these depend on the Android version you would like to target). In my case I went for API 16 (Android 4.1.2), SDK tools, Android device emulator. Pick what you see fit.
- Now it’s time to configure your AVD (Android Virtual Device)
- Go to Xamarin’s page for downloading trials, pick Mono for Android, provide information about yourself and hit download. Run the installer.
Here are some materials to get you started: Mono for Android Tutorials and Guides for free, or should you prefer the book and have some dime to spend - Professional Android Programming with Mono for Android and .NET/C#, happy coding!