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.
![Screen Shot 2021-06-18 at 3.44.48 pm](https://xamarinhowto.com/wp-content/uploads/2021/06/Screen-Shot-2021-06-18-at-3.44.48-pm.png)
However, you’re most likely going to come across issues ranging from: error XA2006: could not resolve reference to ‘Xamarin.Forms.Platform.Android.FlyoutPageRendererNonAppCompat’
![Screen Shot 2021-06-18 at 4.20.21 pm](https://xamarinhowto.com/wp-content/uploads/2021/06/Screen-Shot-2021-06-18-at-4.20.21-pm.png)
to: ‘textEnd’ is incompatible with attribute iconGravity (attr) flags [start=1, textStart=2] [weak]. (APT2259) & failed linking file resources. (APT2061)
![Screen Shot 2021-06-18 at 3.52.54 pm](https://xamarinhowto.com/wp-content/uploads/2021/06/Screen-Shot-2021-06-18-at-3.52.54-pm-1.png)
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.
![Screen Shot 2021-06-18 at 4.36.29 pm](https://xamarinhowto.com/wp-content/uploads/2021/06/Screen-Shot-2021-06-18-at-4.36.29-pm.png)
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.
![Screen Shot 2021-06-18 at 4.40.10 pm](https://xamarinhowto.com/wp-content/uploads/2021/06/Screen-Shot-2021-06-18-at-4.40.10-pm.png)
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
Leave A Comment