Skip to content
Home » Private: Blog » Json.NET crashes when releasing an Xamarin.Android Application

Json.NET crashes when releasing an Xamarin.Android Application

So, after I published my last post, some users reported that the Android app I’m developing didn’t contain any content.

This seemed weird to me, as I knew for a fact, that the iOS version worked just fine.

Fortunately, I am using Xamarin.Insights, which allows me to monitor issues that may arise.

Apperently, the users whom had installed the Android app experienced a lack of content due to a JSON serialization issue which meant that no data was shown – ofcourse, this should be handled by presenting an error message in the UI as well.

The reason was, apparently, that Json.NET crashes in release mode under Xamarin.Android, but not when debugging, which is why I didn’t initially experience the issue myself.

The solution

What you need to do if you experience this issue is to follow these simple steps:

  1. In Visual Studio / Xamarin Studio, right click on your Android project and select “Properties”
  2. Go to “Android Options” => “Linker”
  3. In the field “Skip linking assemblies” enter “System.Core” (without the quotes)
    1. Note: if you have already omitted other assemblies, seperate them using “;” (quotes omitted)
  4. Save

Now, you can release your Android app once more without having Json.NET crashing.’

Testing the solution

If you want to be sure that the solution works before publishing your app to the Google Play Store, you can:

  1. Set your “Solution Configuration” to “Release”
  2. In Visual Studio, open the “Debug” menu
  3. Now click “Start Without Debugging”

Doing so allows the application to be installed in release-mode on your emulator/device.

// Dave

Leave a Reply

Your email address will not be published. Required fields are marked *

This page is under construction