Why does my Xamarin.Forms.Maps Android project fail with 'COMPILETODALVIK : UNEXPECTED TOP-LEVEL ERROR'?


This error may be seen in the Error pad of Xamarin Studio or in the Build Output window of Visual Studio; in Android projects using Xamarin.Forms.Maps.

This is most commonly resolved by increasing the Java Heap Size for your Xamarin.Android project. Follow these steps to increase the heap size:

Visual Studio

  1. Right-click the Android project & open the project options.
  2. Go to "Android Options -> Advanced"
  3. In the Java heap size text box enter 1G.
  4. Rebuild the project.

Screenshot of the Visual Studio Project Options

Xamarin Studio

  1. Right-click the Android project & open the project options.
  2. Go to "Build -> Android Build -> Advanced"
  3. In the Java heap size text box enter 1G.
  4. Rebuild the project.

Screenshot of the Xamarin Studio Project Options

Last Updated: Oct 21, 2016 05:30PM EDT