Search code examples
android-support-librarydependency-managementnuget-packagexamarin-studio

How do I work around that two packages are dependent on the same/similar support library?


I am making an android app in xamarin studio and it needs to have google play services because of google maps api v2 and a QR code scanner for mobile. But when I added zxing.net.mobile to my packages after I had set up google maps and gotten the google play services package, they both fail as they are both dependent on the 'Xamarin.Android.Support.v4' package.

I have tried this on two different solutions and the same thing happens.

I have looked into this on google and stack overflow and found dependency hell on wikipedia, but I can not seem to apply that to NuGet packages when using Xamarin Studio. Dependency hell on wikipedia

And i found this reason for it: Question answer without full explanation on how to do this.

So how does this work, where do I look to change to only using Xamarin.Android.Support.V4 for both ZXing.net and google play services?

Error:

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? File name: 'Xamarin.Android.Support.v4.dll' at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel) at Xamarin.Android.Tasks.ResolveAssemblies.Execute() (TrailMapplication)


Solution

  • Figured out what I had to do, and it solved that problem: I went to my project on my computer and looked into

    C:\Users\Name\Documents\Projects\Solution\Project\bin\Debug

    and deleted a Mono.Android.Services.v4.dll and added the Xamarin.Android.Services.v4.dll instead.

    Had to Re-build the project though but then it worked.