0

I created a new Xamarin.Forms project and I am trying to upgrade the Xamarin.Forms Nuget package from 3.6 to v4.3. When I try to install a newer version I get a runaround of error messages that goes in circles. Here's how it goes:

  • Right click on solution >Manage Nuget Packages
  • Installed Tab >Xamarin.Forms. Shows v3.6 installed in all projects (main/shared project, Android, UWP)
  • Select v4.3 and install upgrade to all projects
  • Error: 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.
  • I search for Xamarin.Android.Support.Compat, select v28.0.0.3 and install it directly into my Android project.
  • Error: Error NU1107 Version conflict detected for Xamarin.Android.Support.Annotations. Install/reference Xamarin.Android.Support.Annotations 28.0.0.3 directly to project HPlusSports.Android to resolve this issue.
  • I search for Xamarin.Android.Support.Annotations, select v28.0.0.3 and install it directly into my Android project.
  • Error: Error NU1107 Version conflict detected for Xamarin.Android.Support.Annotations. Install/reference Xamarin.Android.Support.Annotations 28.0.0.3 directly to project HPlusSports.Android to resolve this issue.

So I follow the instructions in the error messages but the error messages just go in circles. No matter what I try to install there is no resolve.

SendETHToThisAddress
  • 2,756
  • 7
  • 29
  • 54

3 Answers3

1

If only updating Xamarin Forms Nuget Package will occur other Nuget Package conflict with it.

Have a try with follow steps :

  • Right click project solution
  • Click Manage Nuget Package for Solution
  • Go to Updates view
  • Select All Packages
  • Last click Update button

Such as follow screenshot :

enter image description here

Junior Jiang
  • 12,430
  • 1
  • 10
  • 30
  • I don't understand your first sentence but your instructions are clear. I followed them and the previous errors went away. Unfortunately on trying to build the project there was a new error saying I needed to increase the Android target framework to 9.0. So I did that. That error went away but then there were 3 new errors about "Attribute 'closeIcon'" "icon" and "icon tint" already defined. – SendETHToThisAddress May 07 '20 at 20:17
  • I did a search the "Attribute icon already defined" error and was able to resolve it by changing the Android build tools to v29. Turns out the Android build tools I had installed was an old obsolete version. I tried to build and it's finally working! Thanks everyone for your help – SendETHToThisAddress May 07 '20 at 20:30
  • 1
    @technoman23 Glad sovled that ! Thanks for marking it and I have edited answer to be more clear . Your comment will also be very helpful for others to solve this problem :-) . – Junior Jiang May 08 '20 at 01:38
0

To this problem, open your android project .csproj file by notepad.

Add the package into PackageReference directly. Save it and open the solution again.

Example:

<PackageReference Include="Xamarin.Forms" Version="4.4.0.991864" />
<PackageReference Include="Xamarin.Android.Support.VersionedParcelable">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Interpolator">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.v7.RecyclerView">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Fragment">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Core.UI">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Core.Utils">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Annotations">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.CursorAdapter">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Collections">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Compat">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Design">
  <Version>28.0.0.3</Version>
</PackageReference>
Jimmy Pun
  • 11
  • 3
  • OK I tried it, I added the Xamarin.Forms reference in the file via notepad. When I reopen the project in Visual Studio I get the error message again about Install/reference Xamarin.Android.Support.Compat 28.0.0.3 directly into Android project – SendETHToThisAddress May 07 '20 at 01:13
  • Please try to update the version of Xamarin.Android.Support.Compat and it's dependencies library to 28.0.0.3 – Jimmy Pun May 07 '20 at 01:21
  • https://forums.xamarin.com/discussion/166267/version-conflict-detected-for-xamarin-android-support-compat Similar issue for your information – Jimmy Pun May 07 '20 at 01:25
  • Ok I tried it. Gives the following error message now: Error NU1107 Version conflict detected for Xamarin.Android.Support.Annotations. Install/reference Xamarin.Android.Support.Annotations 28.0.0.3 directly to project HPlusSports.Android to resolve this issue. – SendETHToThisAddress May 07 '20 at 01:27
  • Adding all these kinds of libraries to your project will solve it. or you can just copy mine which might have some redundant. – Jimmy Pun May 07 '20 at 01:43
0

Try this procedure. Solution

  1. Update-package
  2. Update-Package -reinstall
  3. Restart visual studio.
M. Hamza Rajput
  • 7,810
  • 2
  • 41
  • 36