Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix Xamarin/NuGet error NU1107? - "Version conflict detected for Xamarin.Android.Support.Compat"

"NU1107 Version conflict detected for Xamarin.Android.Support.Compat. Reference the package directly from the project to resolve this issue. pleaseWork.Android -> Xamarin.Android.Support.v7.MediaRouter 27.0.2 -> Xamarin.Android.Support.v7.Palette 27.0.2 -> Xamarin.Android.Support.Compat (= 27.0.2) pleaseWork.Android -> pleaseWork -> Plugin.Share 7.1.1 -> Xamarin.Android.Support.CustomTabs 25.4.0.2 -> Xamarin.Android.Support.Compat (= 25.4.0.2)."

I keep getting this error when I try to install plugins to my Xamarin projects. I have no idea how to fix this error and I've scoured all over the internet to find solutions.

I've tried to install the same plugin on multiple Xamarin projects all to no avail

like image 376
chungmcl Avatar asked Jul 11 '18 02:07

chungmcl


Video Answer


3 Answers

How to fix Xamarin/NuGet error NU1107? - “Version conflict detected for Xamarin.Android.Support.Compat”

Got the same error message as you, if I install the package Plugin.Share 7.1.1 to my Xamarin with reference Xamarin.Android.Support.v7.MediaRouter 27.0.2.

To resolve this issue, please install the dependency Xamarin.Android.Support.CustomTabs with version 27.0.2 first, then install the package Plugin.Share 7.1.1.

The reason for this solution:

Just like the error message shows, the default package of Xamarin project is Xamarin.Android.Support.v7.MediaRouter 27.0.2, which have a indirect dependency Xamarin.Android.Support.Compat (= 27.0.2). However, the package Plugin.Share 7.1.1 also have a indirect dependency Xamarin.Android.Support.Compat (= 25.4.0.2), which lower than the already installed version 27.0.2. So nuget will give you the error NU1107 Version conflict detected for Xamarin.Android.Support.Compat.

In order to use the same version package Xamarin.Android.Support.Compat, we have to update the referencing package Xamarin.Android.Support.CustomTabs to 27.0.2, which is supported by the referencing package Plugin.Share 7.1.1.

So, the solution for this issue is install the Xamarin.Android.Support.CustomTabs 27.0.2 first, then install the package Plugin.Share 7.1.1.

Hope this helps.

like image 128
Leo Liu-MSFT Avatar answered Sep 23 '22 16:09

Leo Liu-MSFT


If you run into an error trying to update from Xamarin.Android.* v27.0.2.1 to Xamarin.Android.* v28.0.0, first install Xamarin.Android.Support.Custom.Tabs v27.0.2.1. Then you should be able to upgrade to v28. If it complains about any other missing NuGet packages, install their v27.0.2.1 versions as well before updating. I ran into this issue just now so I'm posting this solution that fixed my problem for anyone else who runs into this.

More specifically, I ran into this issue when trying to update from Xamarin.Forms v3.4.0.1008975 to v3.4.0.1009999.

like image 25
MikeBMcL Avatar answered Sep 23 '22 16:09

MikeBMcL


NU1107 is a NuGet Error You can learn solution from https://docs.microsoft.com/tr-tr/nuget/reference/errors-and-warnings/nu1107

For example

Version conflict detected for 'PackageA'. Install/reference 'PackageA' v4.0.0 directly to resolve this issue. 'PackageB' 3.5.0 -> 'PackageA' (= 3.5.0) 'PackageC' 4.0.0 -> 'PackageA' (= 4.0.0)

Solution Install/reference 'PackageA' directly (in the project file) with the exact version that you choose. Generally, picking the higher version is the right choice.

like image 20
Mehmet Avatar answered Sep 19 '22 16:09

Mehmet