Xamarin COMPILETODALVIK : UNEXPECTED TOP-LEVEL error

After adding Google Maps support to your Xamarin.Forms solution, you try to build and receive this really helpful error. This seems to be triggered by the addition of the Google Play Services framework. It’s almost as helpful as ‘An Exception Occured’, another one of my favourites.

Luckily for this problem there’s a simple solution, increasing the Java heap size.

In Visual Studio open the project properties for your Android project and navigate to:

Android Options -> Advanced

Set the value of

Java Max Heap Size

to 1G.

P.S. Don’t forget to set this for each of your build configurations, otherwise come release time you’ll be scratching your head again. Or maybe that’s just me…In VS

Leave a Reply

Your email address will not be published.