Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to update NuGet packages Xamarin.Forms to v2.5 in Xamarin.Android

I am using Windows 10 with Visual Studio Community 2017 (v15.5.6). Right now I'm trying to update NuGet packages for Xamarin.Forms from v2.3.4.231 to v2.5.

NuGet packages Xamarin.Forms updated successfully on Portable project and Xamarin.iOS project, but failed on Xamarin.Android. It keep rolling back to previous version and shows error message "The Collection is read-only".

Thanks in advance for those who can point out my mistakes. :) Many Thanks.

like image 214
Wei Loon Wong Avatar asked Feb 13 '18 08:02

Wei Loon Wong


1 Answers

Okay, end-up I solve this with all this steps:

(1) First select a correct Target Framework for your project. For me, I target Android Oreo. And will be good if your project is supports latest Android SDK. Go to Tools -> Android -> Android SDK Manager to check and install latest SDK.

enter image description here

(2) Before updates Xamarin.Forms 2.5, make sure certain NuGet packages in Android has up-to-date. For my case is I need to make sure packages Xamarin.Android.Support.Design has updated to version 25 or above.

enter image description here

(3) If you hit error message "The Collection is read-only". Go to Tools -> NuGet Package Manager -> Package Manager Settings and click on button Clear All NuGet Cache(s). After this, close Visual Studio -> go to your project folder -> delete all your bin and obj file -> start Visual Studio again.

enter image description here

(4) Okay, now you can update NuGet packages Xamarin.Forms to version 2.5. After update, clean and build project.

like image 106
Wei Loon Wong Avatar answered Nov 14 '22 13:11

Wei Loon Wong