System.TypeLoadException: Could not resolve type with token 0100017e

« Back to list of posts

What caused 'System.TypeLoadException: Could not resolve type with token 0100017e'?

This issue presented itself when I first started trying to get Firebase Cloud Messaging installed on a new Xamarin app for the purpose of adding a remote notifications capability.

Whilst following the tutorial laid out for me on this page: https://developer.xamarin.com/guides/android/application_fundamentals/notifications/remote-notifications-with-fcm/

You have to love that they have 'Beta' slapped accross the page, this almost instantly throws up a red flag for any developer followed by a very large sigh.

Xamarin Beta

The issue was that since the Xamarin tutorial requires you to install Xamarin.Firebase.Messaging, Xamarin and it would conflict with the versions of Xamarin.Android.Support.v4 that they required. The exact case was that Xamarin Forms has a requirement for 'Xamarin.Android.Support.v4 (= 23.3.0)' and Xamarin.Firebase.Messaging had a requirement for 'Xamarin.GooglePlayServices.Basement (= 32.961.0)' which in turn had a requirement for 'Xamarin.Android.Support.v4 (>= 24.2.1)'.

Now we all know that you can't have 'Xamarin.Android.Support.v4 (= 23.3.0)' and 'Xamarin.Android.Support.v4 (>= 24.2.1)' installed on the same project, so what do we do?

The thing is, I went down the route of forcing an update and ignoring the dependency versions which provided me with the error 'System.TypeLoadException: Could not resolve type with token 0100017e' so it was starting to become fairly obvious that you can't just force the version to install and that they have dependencies for a reason.

So we're still left with the knowledge that you need to install the correct version of the package so that it matches the dependency requirements of all the other installed packages.

The Answer:

The simple answer is that instead of installing the package versions specified in the tutorial, you need to install this specific version of Xamarin.Firebase.Messaging... 32.940.0-beta3

Make sure that when you install the package, you check that under Options for that packages, Dependency Behaviour is set to Lowest, and the other required packages will install with it at a similar version and will be compatible with your other installed packages.

More information:

If you're interested in learning how to set up Firebase Cloud Messaging for both iOS and Android in Xamarin, I'll be adding a new blog post by the end of this month on how to do exactly that.


By Luke Alderton at 24 Jan 2017, 11:03 AM

Tags: Xamarin,Android

Comments


Post a comment

Please correct the following:
Share with