Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

enter image description here

...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...

enter image description here

What am I missing or doing wrong?

like image 394
Sev Avatar asked Jan 03 '19 22:01

Sev


1 Answers

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.

like image 66
jgoldberger - MSFT Avatar answered Oct 16 '22 23:10

jgoldberger - MSFT