2
votes

I am really eager to get started with MvvmCross - it looks like a very promising framework for cross-platform solutions. Anyway, I am having a build error as I'm going through the tutorial, https://github.com/slodge/MvvmCross/wiki/Tutorial-Part-1. The error arises in building the Android project component. This is the error:

Error 1 The type 'Android.App.Activity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=c4c4237547e4b6cd'. C:\Users\Steven\documents\visual studio 2010\Projects\Tutorial\Tutorial.UI.Droid\Views\MainMenuView.cs

I saw some similar questions posted (Portable Class Library strong assembly reference problems in MonoTouch/MonoDroid) and followed the suggested solutions but without success. This was in VS2012, so I tried it in VS2010 and encountered the same problem. Has anyone come across this error? The PCL portion (Tutorial.Core) builds fine on its own. I checked the PCL csproj file and saw it is using Profile 104 and I did already create the MonoAndroid xml file that sits in that directory:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile104\SupportedFrameworks\MonoAndroid,Version=v1.6+.xml

The reference for Mono.Android in the Tutorial.UI.Droid project appears to be fine. The path for the dll is C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll and VS reports Resolved=True and Strong Name=True for this reference.

Any help would be greatly appreciated.

1

1 Answers

2
votes

Your problem has nothing to do with PCL. Starting version 4.2, Mono for Android assemblies are strong-named i.e. assemblies shipped by Xamarin will be signed with a Xamarin key. Earlier the assemblies were either not signed or only delay-signed. This change affects the strongnames of some Xamarin assemblies.

Like in your case, it is asking you to add reference to:

Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=c4c4237547e4b6cd

which is strong-named. At present you'd be using:

Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

which is not strong-named.

So all you need to do is re-build all your assemblies (in MVVMCross as well as any other projects you may have) that refer Mono.Android with the new strong-named assembly.

That should fix your problem.