Xamarin Android Support Collection errors after updating to Xamarin.Forms 5.0

Shantimohan Elchuri 721 Reputation points
2021-01-12T16:05:49.617+00:00

Just today I updated my NuGet packages in a project. That also updated Xamarin.Forms to version 5.0. After the update the build complained that the minimum Android Target Version should be 10.0. So I changed it in the project properties. Then I got the following error:

Error Could not find 2 Android X assemblies, make sure to install the following NuGet packages:

  • Xamarin.AndroidX.MediaRouter
  • Xamarin.AndroidX.Palette
    You can also copy-and-paste the following snippet into your .csproj file:
    <PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.2.0" />
    <PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.5" />

So I tried to install the Xamarin.AndroidX.MediaTrouter NuGet package. The install rolled back with the following error:

Error NU1107 Version conflict detected for Xamarin.Android.Support.Collections. Install/reference Xamarin.Android.Support.Collections 28.0.0.3 directly to project ToDoPlus.Android to resolve this issue.
ToDoPlus.Android -> Xamarin.Android.Support.v7.MediaRouter 28.0.0.3 -> Xamarin.Android.Support.Media.Compat 28.0.0.3 -> Xamarin.Android.Support.VersionedParcelable 28.0.0.3 -> Xamarin.Android.Support.Collections (= 28.0.0.3)
ToDoPlus.Android -> Xamarin.Auth 1.7.0 -> Xamarin.Android.Support.CustomTabs 28.0.0.1 -> Xamarin.Android.Support.Collections (= 28.0.0.1).

Then I tried to install Xamarin.AndroidX.Palette NuGet package. This install also rolled back with the following error:

Error NU1107 Version conflict detected for Xamarin.Android.Support.Collections. Install/reference Xamarin.Android.Support.Collections 28.0.0.3 directly to project ToDoPlus.Android to resolve this issue.
ToDoPlus.Android -> Xamarin.Android.Support.v7.MediaRouter 28.0.0.3 -> Xamarin.Android.Support.Media.Compat 28.0.0.3 -> Xamarin.Android.Support.VersionedParcelable 28.0.0.3 -> Xamarin.Android.Support.Collections (= 28.0.0.3)
ToDoPlus.Android -> Xamarin.Auth 1.7.0 -> Xamarin.Android.Support.CustomTabs 28.0.0.1 -> Xamarin.Android.Support.Collections (= 28.0.0.1).

So now my project doesn't build. Shall I rollback to previous version of Xamarin.Forms or remove the support collection ver 28.0.0.1?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,362 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Shantimohan Elchuri 721 Reputation points
    2021-01-13T16:40:48.757+00:00

    @JarvanZhang I tried to follow the doc you linked above. But I don't have the Android Support libs mentioned in it. I have the following libs installed:

    Xamarin.Android.Support.Design
    Xamarin.Android.Support.v4
    Xamarin.Android.Support.v7.AppCompat
    Xamarin.Android.Support.v7.CardView
    Xamarin.Android.Support.v7.MediaRouter

    Anyway as I was getting error on the MediaRouter, I removed Xamarin.Android.Support.v7.MediaRouter and tried to install Xamarin.AndroidX.MediaRouter. But it rolled back with the following message in Output window:

    NU1107: Version conflict detected for Xamarin.Android.Support.Collections. Install/reference Xamarin.Android.Support.Collections 28.0.0.3 directly to project ToDoPlus.Android to resolve this issue.
    ToDoPlus.Android -> Xamarin.Android.Support.v4 28.0.0.3 -> Xamarin.Android.Support.Media.Compat 28.0.0.3 -> Xamarin.Android.Support.VersionedParcelable 28.0.0.3 -> Xamarin.Android.Support.Collections (= 28.0.0.3)
    ToDoPlus.Android -> Xamarin.Auth 1.7.0 -> Xamarin.Android.Support.CustomTabs 28.0.0.1 -> Xamarin.Android.Support.Collections (= 28.0.0.1).

    This also mentions about Xamarin.Auth 1.7.0 which is also installed in my project. Do I have to remove this also? Then what is the replacement for it?

    I updated my VS2019 to v16.8.4 which was available today only. Also installed Android SDK Build Tools 29.0.3. It appears migrating to XF 5.0 is quite messy.


  2. Alessandro Caliaro 4,186 Reputation points
    2021-01-15T20:20:41.24+00:00

    I suggest to create a new project with the same name, update it to XF 5 and copy all your code inside it


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.