Now, AFAIK there are two versions available. v2 (aka vNext) which is supposedly stable and v3 which is work in progress but holds many improvements. Here is how to get v3 sources compiled for Android (I didn’t test others) in case you run into problems like me.
- head to Github repository for v3 branch (optionally)
- use git clone –b v3 git://github.com/slodge/MvvmCross.git do fetch sources
- open MvvmCross_All.sln solution (using Visual Studio 2012) which references all projects for all platforms. If you don’t have Touch support (or others) Visual Studio will let you know. You can safely ignore those warnings.
- build solution. If it does consider yourself lucky, otherwise continue reading.
- If you get something like
Error 172 Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly ‘Newtonsoft.Json, Version=22.214.171.124, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed’. Perhaps it doesn’t exist in the Mono for Android profile?
File name: ‘Newtonsoft.Json.dll’
then there is a problem with build process. My guess is that it happens because portable class libraries, which Newtonsoft.Json.dll is, aren’t officially supported by Xamarin. Yet.
The workaround is to get Newtonsoft.Json sources (use PCL csproj version), include the project into solution and replace the reference in Plugins\Cirrious\Json\Cirrious.MvvmCross.Plugins.Json project with the Newtonsof.Json project itself.
Now you can run samples, at least I did – tested with Samples\Tutorial\Tutorial.UI.Droid.
There is another build error you might encounter (in general for Xamarin.Android). Sometimes the build process yields a ton of senseless errors (can’t find classes, interfaces, etc.) even though the code should compile. Try building again – most of the times it builds without errors the second time.
If you are interested into MvvmCross project make sure you read Stuart’s blog (creator of MvvmCross).
I have to test it a bit now, so more blog posts on the topic might follow.
Have fun with MVVM everywhere.