Due to the expanding number of packages that require Android X (namely Xamarin.Forms 5) it is essential that you can get an old project compiling and running on Android X.  This can come as quite a challenge especially to massive projects that are quite old.  Anyone who has tried to use the built in visual studio “Migrate to Android X” feature has probably realised that it doesn’t always work and you’ll run into compilation errors.

If you’re lucky visual studio will simply ask you to install an Xamarin.AndroidX nuget package as shown below.

However, you’re most likely going to come across issues ranging from: error XA2006: could not resolve reference to ‘Xamarin.Forms.Platform.Android.FlyoutPageRendererNonAppCompat’

to: ‘textEnd’ is incompatible with attribute iconGravity (attr) flags [start=1, textStart=2] [weak]. (APT2259) & failed linking file resources. (APT2061)

The Solution (for me)

Getting straight to the point you need to remove ALL Xamarin.Android.Support packages as they are NOT supported on AndroidX.  Any package reference in your .csproj file with the name Xamarin.Android.Support.xxxx will be removed.

After removal make sure to clean + delete all output folder (bin + obj) from every project in your solution (Thank you to Matthew Robbins for making this effortless with mfractor.  Rebuild and install AndroidX packages as visual studio asks you to (although Xamarin.Google.Android.Material does not include AndroidX in the name it is very important).  The packages that I had to install for this particular project is shown, however your mileage may vary.

TL;DR: Remove all Xamarin.Android.Support Packages, install AndroidX packages as required.

Disclaimer: This is what allowed my app to compile and successfully migrate to AndroidX, however every project is different – leave a comment below if you have any questions