Xamarin Form application failed to load Android project. Root element missing.
Kevin Le
Posted on February 15, 2018
Since I'm responsible for the mobile client, as well as the web app and the server side NodeJS, I bounce back and forth between all of them. Last time I touched the mobile code (which was implemented using Xamarin Forms) was last week. That was when I created an archive and submitted to Google Play and Apple App Store. Both were accepted.
My Windows 10 got auto-updated a few days ago. Then this morning, trying to open my VS2017 solution, I got the error with VS 2017 failed to load the Android project. "Root element is missing". I tried with Xamarin Studio. Same thing happened. OK, reboot the computer. Still failed.
So still being patient, I googled. Someone suggested that the .csproj has a missing root element. OK, but how could it miss a root element if I didn't touch the file. Doing a git status
confirms that nothing was changed. I opened it up anyway, cntrl-A
, cntrl-C
, go to https://www.xmlvalidation.com, and cntrl-V
. XML was validated, no errors were found.
I started to become frustrated and just shouted:
BTW, this is not the first time that I got burned with Xamarin. It's just the first time I decide to document.
I googled some more. Looks like someone had the same problem and posted the same question on StackOverflow. Unfortunately no answer.
Googled. Tried. Still no success. Repeat. One thing I refused to do was uninstall and reinstall VS2017. Who knows how many hours that would take.
Until I found this BizTalk Tips and Tricks article.
Long story short, I renamed the .Droid.csproj.user
, effectively fooling VS2017 that I deleted it, and reload the Android project. Works.
In summary, an article on BizTalk dated in 2010, way before VS2017 was born, solved a VS2017 Xamarin bug, in 2018. Go figure.
In defense of Xamarin, when it's working, it's working great. Until any update, whether it's a Xamarin update, VS update, .NET update or Windows update.
OK, let me go answer that StackOverflow question which was asked some 8 months ago, but still has no answer. And thank you to that BizTalk blog post.
Posted on February 15, 2018
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 23, 2024
November 10, 2024
November 17, 2024