Skip to content

The Joy (Pain) of Xamarin Android (iOS soon) Development Part 1. Making it work out of the box.

So the past 2 weekends I have once again been messing around with Xamarin development in Visual Studio.  I have been following the great tutorial at .

Overall it has been a great tutorial and the author goes over a fair amount at the beginning about the differences between mobile development vs regular programming and the differences between using Xamarin vs native development.  This was good because I feel like a lot of tutorials gloss over how it works behind the scenes.

I was very excited to give it a whirl as my previous attempts at mobile development always ended up being 90% fighting the various IDE tools.  Constantly Googling compile and deployment problems.  I was hopeful that after letting all of the tools marinate a year or 2, everything would work out of the box.  This was not the case, but it was easier than the last few attempts.

After setting up Xamarin and installing all of the required libraries, I loaded up the first simple, basic Android application from the tutorial.  Immediately, I get errors and the program won’t work.  I then try the simple, basic Android application skeleton project and get the same error.  The error was:

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

Great.  I did some Googling and found out I had the wrong version of the Java SDK.  This was troubling because I let Visual Studio and Xamarin download everything, but whatever.

I eventually found the fix here: java Lang UnsupportedClassVersion Error in Xamarin Studio

The fix was to download the latest 64-BIT Java SE Development Kit.  It was important that it was the 64-bit version.  So to fix, download and install the “Windows x64 Java SE Development Kit” from Oracle.

After installing it run Visual Studio and complete the following:

  • Go to “Tools”, “Options”, “Xamarin”
  • Click “Change” by the “Java Development Kit Location”
  • Click the ellipses or “…” and then navigate to the install location of your JDK.  It will probably be a bit different than the one I have listed.
  • OK out of everything, close Visual Studio and re-open it.

So at this point, my code would compile, and then deploy to the Android emulator, but then flicker and crash.  Fantastic.  I looked at the output for any error messages and saw below.  This was really the only error or warning in the console output.

AOT module '' not found: dlopen failed: library

I then did some more Googling and found this post. Xamarin Forms Android App Crashes Running Debug with VS Android Emulator .  The answer outlines really well what you need to do, but I will go over it here as well.  I did both fixes.

Fix #1 “Could not connect to the debugger” issue (Android app starts and immediately closes, debugging stops):

  1. Close the Android simulator window to shut down the virtual machine.
  2. Start the “Hyper-V Manager” (Microsoft program to manage virtual machines in Windows, you have it installed)
  3. Select the emulator you are trying to use
  4. Right-click, hit Settings
  5. Expand Processor
  6. Click Compatibility
  7. In the right pane set checkbox “Migrate to a physical computer with a different processor version
  8. Start the debugging in Visual Studio to restart the simulator

Fixed #2 The missing issue:

  1. Go to the properties of the Android project, hit tab “Android options”, and unselect “Use Fast Deployment”.

I tried cleaning, compiling, and deploying my app again and to my surprise…everything worked!

While not a perfect start, Xamarin development has come along way.

I looked forward to writing my Snood, Angry Birds, Trump meme generator and becoming a gazillionaire!

Leave a Reply

Your email address will not be published. Required fields are marked *