Reputation: 330
"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
Upvotes: 10
Views: 11264
Reputation: 3704
I had this same issue but did not understand how to solve it from the other answers. Since this question has been viewed 6k times and here I am viewing it 2 years later I'll post a solution that might be helpful for others viewing this page. In short, this error typically comes up when trying to install nuget packages or after installing them. It is due to dependency conflicts, and VS and nuget manager don't know what to do. Hopefully in the future VS will implement a way to automatically resolve this but until then...
Here are the detailed instructions on how to resolve the issue: The error message should say something about a package you need to reference or install. Here is an excerpt from the error message I received:
"Error NU1107 Version conflict detected for Xamarin.Android.Support.Compat. Install/reference Xamarin.Android.Support.Compat 28.0.0.3 directly to project HPlusSports.Android to resolve this issue."
Copy the portion that says "Xamarin.Android.Support.Compat" (or whatever yours says to install/reference) to the clipboard. Right-click on your solution file in VS and select Manage NuGet Packages For Solution. When the NuGet Manager comes up click on the Browse tab. In the search bar, paste in that text you copied, then search. The one you need to download should come up as the first result with an exact match in title. Before you install, select the version that matches the error message. In my case my error message said "Install/reference Xamarin.Android.Support.Compat 28.0.0.3 ..." so I selected version 28.0.0.3 to install. Also check the boxes to install where the error message is telling you. In my case it was telling me to install in .Android so I installed to my Android project.
When you go to download/install you may receive another error message similar to the first one you had. If so, install the dependency that error message is telling you about. Keep doing this until you don't receive any additional error messages; you should then be able to install the package you were initially trying to install and build your project with no conflicts.
Credit to Jonathan Dick for posting this instructional video and helping me understand how to solve this issue.
UPDATE: you may be able to resolve this with a quick fix by doing update all. Go to the updates tab, check the box for Select all packages, then click the update button.
Upvotes: 2
Reputation: 755
NU1107 is a NuGet Error You can learn solution from https://learn.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.
Upvotes: 1
Reputation: 424
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.
Upvotes: 1
Reputation: 76760
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.
Upvotes: 5