This error had me hunting for two whole days. I couldn’t understand where the files Xamarin was complaining about. They were certainly not mine….
I noticed that when I backgraded to Xamarin.Forms v126.96.36.19971 the problem disappeared. After fiddling around desperately (as you do) a pattern emerged. The trick seemed to be to not reference the support libraries Xamarin.Android.Support.* that had versions > 188.8.131.52.
As soon as they were referenced, the build crashed and I had bad xml in my resourcecache in the obj folder.
obj\Debug\resourcecache\DA97546C26E54413F6BB75B0531999D2 \res\anim\abc_fade_in.xml(2): error APT0000: Error parsing XML: syntax error
Specifically the files were Android source files. E.g. res/anim/abc_fade_in.xml or res/anim/abc_slide_out_top.xml.
How does this work? Well, when you add a nuget package either explicit (as with Xamarin.Forms) or implicit (as its dependencies) they are downloaded to your packages folder in your solution. When you build your solution, these are unpacked and cached in /Users/<username>/AppData/Local/Xamarin folder. One subfolder per reference and version. Like so:
This is were the bad xml came from. As it happended, Xamarin managed to download the full structure of the source files but failed (silently mind you) to download the content of some of them.
This was the content of one of the files (values-land.xml)
Ah, finally – the error messages really made sense now.
Since these folders only works as a cache, the solution was easy. Delete them.
I deleted the folder at component-level, i.e. AppData\Local\Xamarin\Android.Support.v7.AppCompat. When I did a new build in Visual Studio it downloaded a fresh copy and my build worked.
I of course had to do a clean solution first to get rid of the bad xml in obj\resourcecache.