Debugging Xamarin Android Build and Deployment Failures

Deploying on the Visual Studio Android Emulator with Xamarin is sometimes an ordeal, with many things that can go wrong. Hence, here is my playbook on what to do when things go wrong when deploying for Android.

Last Updated: 6th February 2017.

Build Issues

Errors in Resources.Designer.cs

When you upgrade your Xamarin Forms version or add in other 3rd Party Components, normally the Resources.Designer.cs needs to be regenerated. However this often doesn’t happen. Hence if you go to the file, then delete everything inside the file, then rebuild your app, it should regenerate correctly. If errors still persist inside this file then here are some other possible causes

  1. Your 3rd Party Component doesn’t support the correct Xamarin Forms Version. Check with the 3rd Party Vendor for compatilbilty
  2. Your Android Support libraries might be out of sync with your Xamarin Forms version. For example the Android Support libraries shouldn’t be updated to the latest version. Xamarin Forms normally depends upon an older version. These versions are exact (=) not (>=).
Unzipping failed for android_m2repository

Sometimes you get error messages similar to

Unzipping failed. Please download and extract it to the …~\Local\Xamarin\Android.Support.v4\21.0.3\content directory.

This is due to the fact Visual Studio occasionally corrupts that file. It doesn’t seem to happen anymore but if it does the quickest solution is to go to


And delete everything in this folder. Visual Studio will then re-download everything that is required, including that zip file.

Check SDK Version is Installed

Check that the right SDK version is installed for what you are compiling to as shown in this image below:


Unsupported major.minor version

If you have recently upgraded to a new version of Xamarin, it has now changed to build off a new version of the JDK. In my case going from 1.7 to 1.8. You will receive an error something similar to this on build

Error java.lang.UnsupportedClassVersionError: com/android/dx/command/Main  :  Unsupported major.minor version 52.0 Mobile.Droid

To resolve, first download the latest version of the JDK Java SE. In my scenario it was 8u102. Once installed, please note the installation location, then change your JDK location. In Visual Studio you can go to Tools > Options, then Xamarin > Android Settings. Then update the location of your JDK.


Failing to deploy

If you build successfully yet it doesn’t deploy either due to an actual outputted failure or it just seems to freeze and not deploy here are some things to try:

  1. Put the application into release mode, then deploy. If that succeeds, then try going back to Debug mode.
  2. Untick Shared Runtime and Fast Deploy. Sometimes if my deploy freezes, I need to cancel the build, turn Shared Runtime on or off, then deploy again.
  3. Check Logcat(Android Device Logging). It will contain many messages that help debug at a much greater level than Visual Studio.


Can’t connect to the emulator

Try restarting the ADB server.


Unable to update application


Sometimes your app might fail to deploy if an app of a different version and same package name are on there, even if you manually uninstall the app. Using the ADB as described above issue this command

adb uninstall

Doesn’t deploy, sits waiting

One issue I recently ran into after a brand new install, was it built the app, then never deployed, it sat there waiting for the emulator. If I did adb devices, it didn’t even see the emulator. To fix this issue, go into regedit and location


Then change Path from




Shutdown Visual Studio and your emulator, and try again.

Post Deployment Errors

No Internet Connection

This normally happens when the network interfaces are not setup correctly, or other config errors.

  1. Make sure no other emulators are installed. Android Player (Virtual Box) and Visual Studio Android Emulator are known not to place nicely together. Uninstall any other android emulators on your PC. Genymotion has also been known to conflict
  2. In the Emulator, switch off the Wi-Fi connection and start it again. It then attempts to establish the network connection with your PC again and I have often have this resolve connectivity issues.
  3. Go into Hyper-V management and delete all Android images
  4. Go to Virtual Switch Manager and delete ALL virtual switches. When you start the Android Emulator again it will alert you of connection issues and attempt to recreate everything for you.


Crashes Straight Away

Looking at logcat or having something like Xamarin.Insights (or now HockeyApp) would be the only way to see why this is occurring. Follow the instructions above for looking at logcat, or check Xamarin Insights for any application crashes. Make sure that you have setup Xamarin.Insights to send startup errors, as sometimes the app can crash before the crash report is sent. Dealing With Startup Crashes.

Set Max Heap Size

Sometimes if the app crashes straight away, the crash is due to low memory. One possible solution is that the max heap size isn’t set (or sometimes loses it value). Go to the properties section of your Android app, then Android Options and set your max heap size to 1G (aka 1GB).


Couldn’t load memtrack (No such file or directory)

This one normally occurs when an existing version of your app is on the emulator and not being updated correctly to the new version you are trying to install. The simple fix here is to go to your emulator, delete the app manually, then try deploying again. If you still get this via uninstalling on the GUI, try the adb command:

adb uninstall


If you have any other tips for Xamarin Android deployment errors that you would like to share, feel free to contact me.