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.
What you need to do if you experience this issue is to follow these simple steps:
- In Visual Studio / Xamarin Studio, right click on your Android project and select “Properties”
- Go to “Android Options” => “Linker”
- In the field “Skip linking assemblies” enter “System.Core” (without the quotes)
- Note: if you have already omitted other assemblies, seperate them using “;” (quotes omitted)
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:
- Set your “Solution Configuration” to “Release”
- In Visual Studio, open the “Debug” menu
- Now click “Start Without Debugging”
Doing so allows the application to be installed in release-mode on your emulator/device.