I recently got myself an Android mobile phone and was really interested in writing applications for it. After downloading the Android SDK as well as the 32-bit Java SDK (noooooo!) I got it all installed and running the sample apps with Eclipse and browsed around the code.

Firstly, I wasn’t really too keen on getting into another development environment. Secondly, I really didn’t want to do any Java development if I didn’t have to. C# is my happy place, C++ is for the ugly stuff if you need it, Java is just, well, ugly... Besides the last time I did any serious Java was in college, enter MonoDroid to save the day!

Getting Started

To get everything installed read this guide. Then you can read about the API and architecture to get a better understanding about how it all gels together. Pretty much everything you need including signing up for the newsletter can be found by going directly to www.monodroid.net.

Once you have everything installed it’s pretty easy to get going. The beauty about diving in using a language you are familiar with, means you can get used to the Android SDK without having any knowledge of Java or even C++ (for more advanced features). MonoDroid wraps up all the calls using standard .NET constructs through a JNI bridge, plus, you get all of the power of the standard .NET API’s which work in Linux/Android.

Hello Android

Following the tradition of “Hello World”, let’s jump right in and write an Android application.

  1. Make sure that you have everything installed, this guide couldn’t have made it easier.
  2. Create a new Project in Visual Studio: New MonoDroid project in Visual Studio 2010
  3. MonoDroid does most of the heavy lifting for you. If you’re familiar with Android projects in Eclipse you should have any problems with the structure. Android uses layout and string resource files (the right way) for the UI. Activities are like UI controllers, all the info you need is on the Android Developers website.
  4. Just run the application to check everything is working correctly, if you don’t have a device attached or an emulator running then now is the time to create one:
    Select a device to connect the debugger
  5. If you don’t see anything then just click “Start emulator image”:Select an emulator to start or create a new one
  6. Once again MonoDroid holds your hand by signing the package and also installing the Mono runtime if it’s not already available.
    WARNING: If you are running an emulator then this will take a while, if you have a monster PC that does it in seconds then I hate you.
  7. Unlock the phone/emulator and click the button: The default Hello World application
    That’s it! There is a lot of documentation on writing Android applications. Java isn't that far off in syntax to C# so it will be easy to pick up sample code all over the place.
Download sample code

More Information

The best place to start is the MonoDroid API design documentation. Do yourself a favour and browse the classes in the Android namespace. Make sure you check Android.Provider which gives you access to things like Contacts, Settings, Calls Logs etc. through static classes.

This Justin guy slicked the domain www.mono-droid.com in July 2010 already so this isn’t new, just widely available now and free for the time being. There is a lot of useful information on installing and developing here. He’s got videos too, everyone loves videos.


Comment by masdhani

Hi, good stuff here, i was looking for info about making android app using delphi.

Comment by Nilesh

Pretty much everything needed to get started. Nice Article...Thank You

Comment by Droid X Cases

Looks like it's not that difficult to get into Android development. I guess that is why the Android Market has so many apps. Thanks for the tutorial.

Comment by Soan

Wow..i did not knew that we can develop Android apps using C# itself. But looks like the IDE of Mono is a paid one. Is there any other such tool available for free?

Comment by Soan

Can we use .net DLLs also with Mono For Android? I mean embedding them in the bin folder just like we do in normal web apps?

Comment by Werner

[b]@Soan:[/b] MonoDroid is indeed a paid for product and rightfully so, it's very unique and build off Mono (free) bridge .NET on a seemingly unsupported platform. It is getting taken very seriously though and sponsored by Xamarin now providing professional support. I haven't seen a free product yet since you can already use Java or Native C++ to write Android applications, it's unlikely something like this will be free anytime soon.

All the same rules apply for Android (or rather applications executing on Mono) as they do in a Windows environment, web or desktop. Dependencies will always be searched for in the direct executing directory of the application, GAC, PATH and alternative configured probing paths. The idea behind Mono is to be able to deploy and run your application on a non-Windows platform without any significant changes. It even changes Windows path backslashes (\) to forward slashes (/) when running on Linux to maintain compatibility. As stated on the Mono site
[quote]An open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET[/quote]
means your app won't know if it's calling Mono framework assemblies, Microsoft .NET framework assemblies or your own custom built ones.

Comment by Raheel

I love developing apps for Android but before coming through this post I have no idea that it is possible even with C# in Visual studio.you really gives me the thing I need most in my life.

Comment by Lynz

My life is now complete! :D
Well, not exactly, but thanks for this awesome article! Gonna have tons of fun with this now.

Comment by comrade

Yeah, sadly, it IS paid.... and its price is about 999 € or $ (I forgot)
I first thought it was bout 99, but noo, its a thousand bucks D:

Comment by Fred BUtz

It would be nice for a hobbiest version. But it is too pricy.

Fred BUtz
Comment by Henry

Thanks for your artical. It is good to know how to develop for that platform with .NET

Comment by Jurgen

For personal use you can buy the professional license, $400.

Comment by Taersious

I was so excited to find this article. Then only to find out I am going to be forced to fork over some serious kizash. No thanks! Plz let us know up front before providing a link off site "To get everything installed" that we are going to be dinged to install.

Comment by Werner

At the time the article was written, MonoDroid was still open source and freely available. About three months later the project developers got canned and Novell bought them out. It was once again bought by Xamarin who decided to close the source and sell it some time after that.

Now it's only available as a trial and I don't mean to dupe anyone into buying it. Here's an article of when it all happened if anyone is interested: conceptdev.blogspot.com/.../...marin-what-now.html

Comment by Dades93

Thats it ! I finally found it. Thank you very much for the tutorial. I really was looking for articles that discuss the making android app. once again, thank you.

Comment by idgamer

life is now complete! :D
Well, not exactly, but thanks for this awesome article! Gonna have tons of fun with this now.

Comment by Alana

Android SDK build in C language programing

Comment by imonbee

Thanks for your artical. It is good

Comment by imonbee

thanks for info serrr

Comment by modigames

i like your post about android application in visual studio :D

Post comment