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 Visual Studio for Mac 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
- Right-click the Android project & open the project options.
- Go to Android Options -> Advanced
- In the Java heap size text box enter 1G.
- Rebuild the project.
Visual Studio for Mac
- Right-click the Android project & open the project options.
- Go to Build -> Android Build -> Advanced
- In the Java heap size text box enter 1G.
- Rebuild the project.