I recently developed a iOS and Android app with Xamarin. The app was used by a relative small number of users on a business event where I was personally present. Although the app ran find on all iOS devices and most Android I had a few Android devices where the app was consistently crashing at the same place. I decided to submit two crash reports which I later investigated in Goole Developer Console.
It turned out the app crashed on: java.lang.NoSuchMethodError: no non-static method "Landroid/view/View;.setForegroundTintList(Landroid/content/res/ColorStateList;)V"
It looks like it's crashing on the call to setForegroundTintList
. I've set my app for compatibility to API level 15 and this is documented to be only available from API level 21. So, here you go...
But wait, no, the devices from which I submitted the crash reports were running Android 5.0 and 5.1 and both should support API level 21 and up. One of the devices is a Samsung Galaxy Core Prime (Android 5.1) and the other is a Samsung Galaxy S5 (klte), supposedly running Android 5.0 according to the crash report, although the developer console list it (being shipped??) with Android 4.0.3 - 4.0.4.
I'm very new to Xamarin and Android development so can anybody explain this? And what should I do to prevent this in the future?
Set up more emulators for some key versions of Android and test in more emulators? Is there anything the compiler can do for me. Even when I lower the target API level to API level 15 it compiles and builds fine. Shouldn't it complain about using methods not available in the target API level?