Android development for .NET developers
A couple of years ago I switch tracks from being a .NET web developer to being an Android developer. Its not the first time I’ve switched tracks and I am sure it will not be the last. Recently I did a presentation giving people with a .NET background a general map of the terrain in Android development and I wanted to capture the information in the presentation here.
Prerequisites
You can use what you like, I use a Mac at work and Windows at home and they both work fine. I’ve not done Android development on Linux but I have done other development there and it seems to work just fine. Use what you have or what you like.
If you want to publish your app on the Google Play Store then you will need a Google Developer account. This will incur a one off cost of 25 USD. If you just want to side-load APKs onto devices then you don't been an account.
The main prerequisite is that you want to write code. If you want to have a go and have the enthusiasm to build an app to solve a problem then you will be fine.
Tooling
The base set of tools from .NET all have equivalents and they all have free versions.
Tool | .NET | Android |
---|---|---|
OS | Windows Linux Mono |
Windows Linux Mac |
IDE | Visual Studio SharpDevelop Visual Studio Code |
Android Studio Eclipse Intellij IDEA |
Build System | Msbuild | Gradle Ant |
Code Refactoring | Resharper | Android Studio |
Package Management | Nuget | Maven |
Build Server | Team City Jenkins |
Jenkins |
In .NET most development is done in Visual Studio and in Android development most use Android Studio, unless you have a very good reason not to I’d jus go with Android Studio. The functionality of Android Studio is easily on a par with Visual Studio. Android Studio is a tailored build of Intellij IDEA, so if you already use IDEA you might want to stick with it. Eclipse is for masochists.
I was not a great fan of Nuget, I found it buggy and brittle however Maven appear to just work fine.
Libraries
There are equivalents for most libraries, however some areas are not as well represented. For example there are a lot of Data Access and ORM libraries for .NET but a lot less for Android, however android apps typically have a lot less use for an ORM.
Library | .NET | Amdroid |
---|---|---|
Test Runner | nUnit, xUnit |
jUnit |
Mocking | Moq, Rhino Mocks |
Mockito |
DI | Ninject, Castle Windsor, LinFu |
Dagger2, RoboGuice |
Logging | nLog, Log4Net |
slf4j |
Framework | MVC, MVVM |
Roll your own, Mortar |
Patterns | Rx.NET | RxAndroid |
Plumbing | JSON.NET | Jackson, Gson |
REST Access | Web API Client | Retrofit |
Data Access | ADO.NET, NHibernate, Dapper, Entity Framerowk, LLBLGen, Lightspeed etc. |
SQLBrite, Roll your own |
Android libraries without a direct equivalent
These are the common set of additional libraries I use. You do need to be aware that there is a DEX limit on the number of methods you can have and so you cannot use every library you can find and on that note be aware that Google Play Services are particularly heavy weight, and also require a Google phone as opposed to just an Android device, for example a Kindle, to run.