SharePlugin: NuGet error when upgrading Xamarin.Android.Support.Compat packages

I have a Xamarin.Forms project that references the Xamarin.Android.Support-NuGet packages, currently version 25.4.0.2. The project also references your SharePlugin, version 7.1.1. When I try to upgrade the Android Support packages, I get this error:

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

The reason for this is, that the Share plugin version 7.1.1 still uses Xamarin.Android.Support.CustomTabs 25.4.0.2. Could you upgrade those packages and issue a new NuGet package of the SharePlugin? That would help me upgrading all NuGet packages. Many thanks! Michael

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 16

Most upvoted comments

Didn’t work for me. I had to first install xamarin.android.support.annotations, then ***.compat, then ***.CustomTabs, then ***.Core.UI, then ***.Core.Utils, then ***.Fragment, then ***.Media.Compat And only then I was able to install the updates available.

Add latest version of custom tabs and then upgrade others. This is a nuget issue

Add the latest version of custom and first.

Just edit the csproj file and add this:

 <ItemGroup>
    <PackageReference Include="Xamarin.Forms" Version="4.0.0.135214-pre4" />
    <PackageReference Include="Xamarin.Android.Support.v4" Version="27.0.2.1" />
    <PackageReference Include="Xamarin.Android.Support.Compat" Version="27.0.2.1" />
    <PackageReference Include="Xamarin.Android.Support.Core.UI" Version="27.0.2.1" />
    <PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="27.0.2.1" />
    <PackageReference Include="Xamarin.Android.Support.Fragment" Version="27.0.2.1" />
    <PackageReference Include="Xamarin.Android.Support.Media.Compat" Version="27.0.2.1" />
    <PackageReference Include="Xamarin.Android.Support.Annotations" Version="27.0.2.1" />
  </ItemGroup>

For anyone interested in the solution, here’s the commit in my github project: https://github.com/vividos/WhereToFly/commit/5c800f321653bcc9415e38202b4d7d0505f179a7 I had to update the Xamarin.Android.Support.* projects to 27.0.2. Then I got the error in my first comment, and to fix this I had to manually add the Xamarin.Android.Support.CustomTabs to my Android project, even though I don’t use it. Rebuilding, and the NuGet error went away.

Just edit the csproj file and add this:

 <ItemGroup>
    <PackageReference Include="Xamarin.Forms" Version="4.0.0.135214-pre4" />
    <PackageReference Include="Xamarin.Android.Support.v4" Version="27.0.2.1" />
    <PackageReference Include="Xamarin.Android.Support.Compat" Version="27.0.2.1" />
    <PackageReference Include="Xamarin.Android.Support.Core.UI" Version="27.0.2.1" />
    <PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="27.0.2.1" />
    <PackageReference Include="Xamarin.Android.Support.Fragment" Version="27.0.2.1" />
    <PackageReference Include="Xamarin.Android.Support.Media.Compat" Version="27.0.2.1" />
    <PackageReference Include="Xamarin.Android.Support.Annotations" Version="27.0.2.1" />
  </ItemGroup>

Thank you SO MUCH! This worked flawlessly and should be posted elsewhere because it was very difficult to find. If you are having issues updating, go to this and change 27.0.2.1 to the version you are trying to update to.

Thanks, that fixed the problem! I added the latest version of Xamarin.Android.Support.CustomTabs to my Xamarin.Forms project after updating the other Xamarin.Android.Support packages, and then it worked.

I still having the problem, When adding the latest version of Xamarin.Android.Support.CustomTabs , it gives me error that its not compatible with .netstandard 2 ?

It’s been a long time mate, I don’t remember in detail. All I remember is that I tried installing the package I needed and saw an error regarding ***.Media.Compat. Tried installing ***.Media.Compat and got another error regarding ***.Fragment. Tried ***.Fragment and got error about ***.Core.Utils… And so on. I kept trying the packages with errors until one worked and now I knew exactly the ones I needed and the right order.

Having said that @dpedrinha, if you have a minute to point to how you knew to:

“first install xamarin.android.support.annotations, then ***.compat, then ***.CustomTabs, then ***.Core.UI, then ***.Core.Utils, then ***.Fragment, then ***.Media.Compat”

That would be fab … in the spirit of “teach a man to fish” n all 😃