Corrado Cavalli
Feb 14 · 2 min read

A couple of solutions to problems I’ve struggled with…

I’ve spent all afternoon hitting my head against the desk in order to fix a couple of really weird errors I got with Xamarin that’s why I want to share them here so that you don’t have to do the same.

Problem 1: I’ve created a brand new Xamarin Forms app, upgraded Xamarin Forms package to latest (at the moment of this writing) stable version 3.5.129452 and then, without doing anything else, I’ve launched the Android app and, boom! the app crashed with following error

Very clear no?

As everyone I’ve Googled and general suggestion was to get rid of Xaml Compilation by commenting the attribute from the App class.
Doing that was working indeed, but why should i give up on Xaml Compilation? 😒 so I spens some time doing some tests and after a good dose of fortune I’ve found that the version of XF package used by iOS and Android project was misaligned.

After aligning the packages the problem was solved.

Problem 2: Same empty Xamarin Forms project, started adding a series of .NET Standard 2.0 projects to the solution and references them from head project, without consuming any type from those projects.
Launched the Android project and, guess, boom! a weird Java error I can’t even remember.
Did the same with the iOS project and if was running fine. 😒

I then started adding single projects until i found the one was causing the problem, since it was Android only I thought it has to be some Android dependency inside the packages used by the .NET Standard project since I have absolutely no Android specific code in it.
After some investigation, and, again, a lot of fortune, I stumbled into this

As you see Microsoft.Identity.Client requires Xamarin.Android.Support.AppCompat≥27.0.2 while Xamarin Forms template install version 26.
After upgrading all packages, also this problem gone.

I have a dream: A world when all this problem would be finally gone, but I’m afraid that it will never become reality. 😒

Corrado Cavalli

Online thoughts of a technology funatic

Corrado Cavalli

Written by

Microsoft MVP mad about technology. MTB & Ski mountaineering addicted.

Corrado Cavalli

Online thoughts of a technology funatic

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade