Issues updating Xamarin: unable to resolve dependencies - xamarin

I recently decided to update everything in my Xamarin workspace, including all NuGet packages, and Xamarin.Forms.
I first installed all the newest Xamarin.Android.Support packages, which clashed with the current version of Xamarin.Forms that I had, so I decided that I needed to update Xamarin.Forms anyway. I removed it and installed all the other packages (which worked lovely) and now I am trying to reinstall Xamarin.Forms again, but I am receiving:
Unable to resolve dependencies. 'Xamarin.Android.Support.Design 23.4.0.1' is not compatible with 'Xamarin.Forms 2.3.0.107 constraint: Xamarin.Android.Support.Design (= 23.3.0)'.
Any suggestions?

I'm quoting James Montemagno from the Xamarin Forums here.
Xamarin.Forms locks in a very specific version of the support
libraries and google play services. You can't update them because
Xamarin.Forms isn't compatible with them as it would need to be
re-compiled.
Xamarin.Android.Support.v4 (= 23.0.1.3) Xamarin.Android.Support.Design
(= 23.0.1.3) Xamarin.Android.Support.v7.AppCompat (= 23.0.1.3)
Xamarin.Android.Support.v7.CardView (= 23.0.1.3)
Xamarin.Android.Support.v7.MediaRouter (= 23.0.1.3)
See the = 23.0.1.3, which means it is only compatible with that
version number. This is just how NuGet works. When Xamarin.Forms
updates these packages will auto update.
Forms gets 'linked' to a specific version of the Android libraries so it can be guaranteed that it will work together as it should. At this point, Xamarin.Forms (stable) isn't updated yet to use the latest Android Support packages. So you probably want to go with a somewhat older version of Forms, or check if there is a Forms pre-release which already has a reference to the newer Android Support libraries.
Of course; using these is not recommended in a production environment.
They added it in the official FAQ

You can't update Xamarin.Forms and Xamarin.Android at the same time. As It has dependency issues with versions.
So first, Select only Xamarin.Forms 2.3.0.107 and update.
After that, Select rest of the Xamarin.Android.support lists and update.

I would extremelly recommend by 1 year of experience with Xamarin.Droid and Xamarin.iOS to only update Xamarin.Forms to latest version, and ignore Other Xam.Support Libraries unless is extremelly necessary to bug fix something that you need.
Reason #1: It is not fully tested by Microsoft.
Reason #2: You might need to spend hours configuring and fixing the references e version compatibility.

According to me own experience, I would recommend to:
If your project is very old, try to migrate the list of your packages from packages.config to the .CSPROJ. Unlike packages.config, PackageReference lists only those NuGet packages you directly installed in the project. As a result, the NuGet Package Manager UI and the project file aren't cluttered with down-level dependencies. More info here
Clean the Nuget packages cache(s) : Tools -> NuGet Package Manager -> Package Manager Settings -> Clear All NuGet Cache(s)
Use the NuGet Console to get more details about you errors. Open the console (Tools -> NuGet Package Manager -> Package Manager Console), then type Update-Package
Always Clean and Rebuild after updating your packages

For Resolution follow below steps
Close Visual Studio and Navigate following Folder
C:\Users\\AppData\Local\Xamarin
and Remove “ Zib “ Folder
(it will re-create automatically while build solution )
Right Click
on Your Solution /Project ➔ manage nuget Package➔ Click on Update
tab ➔ Update Xamarin Form
Restart Visual studio⇒Open project ==>
Clean Solution and build Add your Nuget package Now
Refered from : https://xamarininterviewquestion.blogspot.in/2016/12/upgrade-nuget-xamarinandroidsupportdesi.html

Starting with Xamarin.Forms 2.3.4 you can manually update all the Xamarin.Android.Support NuGet packages. The condition is that the Target Framework and the Target Android version options of your project (if you don't know what I'm talking about check out this page: Understanding Android API Levels) are set to at least Android 7.0, i.e API 24, or higher.
The official Xamarin documentation has also been updated: Xamarin Forms Troubleshooting

Related

Updating Xamarin Forms produces "invalid android support library configuration" error when building.

I updated Xamarin Forms to 3.4.0 on a Xamarin Forms Android project that was working fine. Now I am getting this error when attempting to build. The error is "invalid android support library configuration" and when I look at my Package Console I see this...
...saying that some of my Xamarin.Android.Support.xxx packages need a downgraded package for compatibility. Problems is, my project does not have any of this packages as you can see by my "Packages" folder here...
What am I missing or doing wrong?
This can happen if you update ALL of the nuget packages in a Xamarin.Forms Android project.
Xamarin.Forms has specific dependencies on specific versions of the Xamarin.Android.Support libraries, and if you update ALL of the nuget packages in the Android project, then the support libraries may update to versions later than the versions that the new Xamarin.Forms version supports.
At this point I would uninstall Xamarin.Forms package from the Android project and also uninstall all of the dependent support library packages, which are listed here under "Dependencies": https://www.nuget.org/packages/Xamarin.Forms/
So in the Android project, uninstall the following nugets:
Xamarin.Forms
Xamarin.Android.Support.Design
Xamarin.Android.Support.v4
Xamarin.Android.Support.v7.AppCompat
Xamarin.Android.Support.v7.CardView
Xamarin.Android.Support.v7.MediaRouter
Once uninstalled, just re-install Xamarin.Forms and the correct versions of the support packages should be re-installed.
In the future, just update the Xamarin.Forms packages and that will automatically update the support library packages if necessary, and will not update the support libraries if the newer support library versions are not supported by the updated Xamarin.Forms version.
Updating Xamarin.Forms and all *.Support.* libraries to the latest version worked for me.
You have a version compatibility problem, if you have updated some packages recently, you must go to the package manager "NuGet/Update" you will find all Xamarin packages need update.

Xamarin - Updating nuget packages caused errors

I created a "Cross-Platform App (Xamarin.Forms)" app, and i immediately went and update the nuget packages (this is what i was told to do). Then i tried to built it, and not only I got several errors(see bellow) that were about the updated packages, I had code errors as well. I swear the God that i didn't touch the code of the project at all, and here is what I get:
I googled, but i couldn't find out a clean solution for this. I am just one step before quitting this (unprofessional) product, because i cannot run the ready template. Is there someone that can give me a piece of advice for these ridiculous errors ?
Could not install package 'Xamarin.XXXXXXX'. You are trying to install this package into a project that targets 'MonoAndroid,Version=vX.X'
You need to increase your "Compile Target Framework" to at least 7.0 as this error indicates.
You can review the dependancies of a package on the Nuget.org site by looking at the Dependencies section of a particular package:
https://www.nuget.org/packages/Xamarin.Android.Support.v7.AppCompat/
Another SO question/answer example that requires at least MonoDroid 8.0:
https://stackoverflow.com/a/49138485/4984832
Example:
Xamarin.Android.Support.v4 27.0.x.x requires at least MonoAndroid 8.1 to be set as the Compile Target Framework:
You have to use newer android SDK version. You can download the SDK from android SDK manager and then select it from project properties

can't update or install any nuget packages in vs 2017

I just installed vs 2017 and wanted to run my project but i'm facing so many warning and errors so I realized I should update my xamarin.android nuget packages but I keep getting this error message below:
Severity Code Description Project File Line Suppression State Error Could not install package 'Xamarin.Android.Support.Animated.Vector.Drawable 27.0.2-preview1'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v8.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. 0
Repairing vs didn't work; deleting nuget.config didn't work; I even changed the version in .csproj file, but when i load the project it goes back to v8.0.
Can anybody please help?
can't update or install any nuget packages in vs 2017
Just as Jon said, the latest nuget package Xamarin.Android.Support.Animated.Vector.Drawable 27.0.2-preview1, which requires MonoAndroid81 at minimum to install.
However, only the latest Preview (15.6 Preview 2) version of Visual Studio includes Android 8.1 support. As this moment, current release version is 15.5.4, preview release version is 15.6 Preview 2. So if you want use that nuget package the latest version 27.0.2-preview1, you need download the latest version of Visual Studio 15.6 Preview 2 and install Android SDK 8.1.
If switch to Visual Studio 15.6 Preview 2 is not your choice, you should not update that package to the latest version, just use the version 26.1.0.1.
Hope this answer more clear.
This requires MonoAndroid81 at minimum to install. You can use the current Preview which includes Android 8.1 support:
https://blog.xamarin.com/xamarin-android-now-double-stuffed-with-oreo-8-1/
For future reference, the support library has a major version that maps with the Android version it supports. In this case Support v27 = Android 8.1 (API 27)
When errors appear, clean your solution and rebuild it.
Also do something very basic, that what you are going to download is "accessible " in .Droid and that is not only in the Portable.
If you do not serve, and do not find a solution, you must start a new project, it would be advisable to install the latest SDK, etc.

Unable to update the xamarin.support.v4 packages

while updating my NuGet packages I am getting this issue
Unable to resolve dependencies. 'Xamarin.Android.Support.v4 25.4.0-rc1' is not compatible with 'Xamarin.Forms 2.3.5.253-pre5 constraint: Xamarin.Android.Support.v4 (= 23.3.0)'.
Can any one guide me for this issue
Thank You
You should not update Support libraries by your self. Instead update only Xamarin.Forms package and it updates his dependencies automatically.
Now, try to uninstall all Support libraries and Xamarin.Forms, install Xamarin.Forms again and it would add all dependencies needed.
As a reference, take a look at this.
I ran into similar the other week (blindly clicked update and it all went wrong), my solution was to downgrade Xamarin Android Support (I'm on 23.3.0) although I'm only using Xamarin Forms 2.3.4.247 I believe the issues is common.
From memory this was a bit of a pain and had to actually remove them one by one and add them back in (maybe take a screenshot of what packages are installed so you don't forget!), but 23.3.0 was the magic support version.
HTH
Solution 1.
Update xamarin forms to latest version.
Xamarin.Android.Support.v4 25.4.0-rc1 is having some dependence on latest xamarin.forms
Solution 2.
Install older version of Xamarin.Android.Support.v4 .
Check the version dependence before installing and ensure that older version do not have dependence on xamarin forms.

Can't upgrade Xamarin.Forms NuGet package for Android project

When I am trying to upgrade Xamarin.Forms NuGet package from 2.0-2.1 to 2.3.1.114 (latest stable at the moment) I get the following error (even with new blank projects) is there a way to fix it?
Severity Code Description Project File Line Suppression State
Error Could not install package 'Xamarin.Android.Support.v4 23.3.0'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
0
Try this option for your project:
This error is most probably because your xamarin forms version is not compatible with Xamarin.Android.Support.v4 23.3.0 available through NuGet. Check this thread on xamarin official forum. As per this thread, 23.3 is not supported by Xamarin forms. On more possible reason is that your xamarin form version is not compatible with the latest update. You can try updating forms to latest version. In case if that doesn't work, then probably you should continue with the version you already have.

Resources