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

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.