dotnetco.de

Android Emulator stays black on Xamarin Forms Apps

Suddenly Android Emulator does not work on my Xamarin Forms Project anymore. Don’t know why, but Xamarin only says “Starting Android_Accelerate_x86”, Android Emulator pops up but stays black and nothing happens….

I’ve searched forums and found some posts but none of them helped. So I just tried to start the Emulator without any application deployment. In Xamarin Studio you could use “Tools” -> “Devices” (in the Android section) .

In the new window select your device and click “Start Emulator”.

In my case, here also the Emulator just shows a blank screen. So problem is not related to Xamarin Forms or Xamarin Studio or my Xamarin App.

So I started Android Virtual Device (AVD) Manager, available in Xamarin Studio at “Tools” -> “Google Emulator Manager”.

Select your device, e.g. “Android Accelerated x86” and click “Start”. A new window appears. And now here is the important step: Tick the checkbox “Wipe user data”! In my case this fixed the problem and Android Emulator starts fine now!

Great! So now I could debug my app with Xamarin Studio again….. Hmm… Now the Emulator opens fine, but my app does not work anymore. “Unfortunately, YourApp has stopped.” …. ? OK, closed Xamarin Studio and created a new blank project. Compiled fine. Now running on Android…. “Unfortunately, Testapp has stopped.”

No further error messages….. hm….

In this thread, it is proposed to disable Android Build Option “Use Shared Mono Runtime” so I tried that. The same result is received if you just switch from “Debug” to “Release” because shared mono runtime is not in use on release builds.

Now the emulator does not come up anymore, but the following error message is shown:

Deploying package to ’emulator-5556′
The package does not support the device architecture (x86). You can change the supported architectures in the Android Build section of the Project Options.
Deployment failed. Architecture not supported.

Searching for this error message shows this thread containing the tip to enable x86 in the advanced build options of Android Project settings.

And bam! Now it’s finally working fine!

At least in release mode. Now trying in Debug Mode where all Supported ABIs are already ticked but leaving “Use Shared Mono Runtime” unchecked….

But even though the emulator shows up, only the boot screen “Android” sign is shown and nothing happens. Xamarin Studio still says “Starting Android_Accelerated_x86” for minutes… And I could not even quit the emulator. I had to use the forced quit to stop it.

And now, when I start my app again with release mode, it does not work again anymore…. So I have to start the emulator via AVD and select “Wipe personal data”. At least this does not happen every time, so as long as I stay in release mode it still compiles and displays fine….

Anyway. Currently I’m fine with running Android in the release version. So the steps to get at least the release version running on Android Simulator are:

  • Start Emulator via Android Virtual Device Manager and select “Wipe personal data”
  • Switch mode from “Debug” to “Release”

 

Very strange: Now I closed my testapp and opened another Xamarin Forms solution. It runs fine in release mode. I changed to debug mode, having “Use shared mono runtime” disabled. Error message: Architecture not supported. Ah fine, I have to enable x86 as shown above. And now it also runs fine in debug mode….? So I enabled “Use Shared Mono Runtime” which automatically ticks all ABIs, And it still works fine…. That’s now the same configuration as right at the start….

2 Comments

  1. Kai! Thank you very much for this post; I was pulling my hair out for a while and couldn’t figure where I went wrong! Thanks again!

Leave a Comment