How to upgrade to new versions of Xamarin.Android and don’t die in the process

One thing that’s always a mission is updating the NuGet packages for Android. I right click the project and hit update and don’t remember the last time it work properly, to be honest, either, takes too long or returns an error. There’s always a dependency not satisfied for X or Y reason, and the package console provide the list of those dependencies, but for me (let me repeat, for me) is hard or tedious to go one by one and update and come back again and update those dependencies. So… I was looking for a workaround this and find a pretty good trick that I don’t know if will help everyone out there, but at least for me did the trick pretty quick and clean.

  1. In your Xamarin.Android Project go to the folder and find the file called packages.config and open it.
  2. Find the packages called Xamarin.Android.* and update the version that it says there to the desired one. For example 28.0.0.1 to 28.0.0.3, Save it and close it.
  3. Go to your Xamarin.Android Project file (theBigCoolProject.csproj) and edit that file in a text editor, find the relevant Xamarin.Android.* files and replace the version numbers and save it.
  4. Delete the bin and obj folders of your Xamarin.Android Project.
  5. Go to visual studio and restore the packages… wait for it to finish (it should be quick).

…And… done! It upgrade the core packages and allow me to upgrade Xamarin.Forms without issues and must important, the project actually build and run. It saves me very good time of productivity. Again, I don’t think is a final solution to the issue, because I hope the IDE does that better in the future but for know, this reduce the pain. Probably I just discovered the hot water but like to spread the awareness and help anyone dealing with this.