13

I recently got into Xamarin development. I have a lot of experience in Xcode making iOS apps and the iOS side was very straight forward. Now I'm trying to implement Android. I downloaded a Hello World example to get my bearings. When I run it I have no problems getting the simulator to show up (MonoForAndroid_API_10 and MonoForAndroid_API_12) but the actual application doesn't run, and does not show up anywhere on the simulator. Essentially whenever I use run or run with in Xamarin on Android, it pulls up a fully functioning, albeit empty simulator.

How do I get my application to run on the emulator?

casvaart
  • 555
  • 1
  • 5
  • 14
MingMan
  • 911
  • 1
  • 10
  • 31
  • There is no such thing as "Xamarin Android Emulator". If you are using the standard ARM images, you might have to start debugging, then take a one hour nap and then you might be lucky to have the app installed and running. They are super slow! Use a real device or use an x86 image or Genymotion. – Cheesebaron Jul 26 '14 at 22:52
  • 1
    Right, I just meant the Emulator that is included in Xamarin, which is the ARM. And its interesting because the emulator works fine, starts up in a reasonable amount of time and is usable, but its just the app never loads up. Thanks for the tip ill try it out with the other alternatives – MingMan Jul 28 '14 at 14:52
  • No it comes with the Android SDK, which in turn is bundled with the Xamarin installer. Don't confuse it ;) If you look at the debug log it is probably installing the mono runtime or something, which is the most time consuming part on a fresh AVD image. – Cheesebaron Jul 28 '14 at 23:28
  • For the ones experiencing this problem, try this : http://stackoverflow.com/a/32564067/7505268 – Colin Calvat Feb 02 '17 at 15:44

7 Answers7

5

Like the other commenters, this is most likely just a symptom of slow emulator on your machine. I'm running Xamarin-Android development on my 2010-era OSX machine in mavericks with 8GB RAM, and it is slow-slow-slow, but usable. Try to find the Intel x86 speeds improvements (look for HAXM) and you will find that the emulator will be much much faster.

And yeah, get a real handset and plug it in to your computer: always much faster than emulation.

later edit Get Genymotion for Mac OSX or for PC/Windows or PC/Linux. It's way way way faster than the other emulators. I have since found that this is as fast, or faster, than running the App on my connected Android phone. It's certainly simpler in not having to have the device plugged into one of my USB ports, and allows me to code and test on the train. http://www.genymotion.com/

Phil Ryan
  • 855
  • 1
  • 10
  • 16
  • 1
    I have had a lot of joy using the awesome [Xamarin Android Player](http://developer.xamarin.com/guides/android/getting_started/installation/android-player/). It's fast and it's free. – Jannie Theunissen Jun 08 '15 at 11:44
  • @JannieT, I'm pretty sure that the Xamarin Android Player is a custom version of Genymotion, due to the extremely close parallel between the XAP sidebar and the Genymotion sidebar. But I agree that the XAP is a better choice for a Xamarin developer. – Phil Ryan Oct 30 '15 at 01:14
  • Noting that even though Xamarin has deprecated the Xamarin Android Player, I still like it, probably more than the Visual Studio Emulator for Android. And if it isn't suitable, then go back to Genymotion https://www.genymotion.com/ – Phil Ryan Sep 20 '17 at 03:23
5

Don't know if my issue was the same but finally this troubleshooting helped me to run emulator https://msdn.microsoft.com/en-us/library/mt228282.aspx#ADB. I was missing key Android SDK Tools with string value Path in registry Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node

I've created it manually and it worked.

enter image description here

UPDATE

Before I got the issue with running emulator, I couldn't see it in Visual Studio. The reason was I've installed VS Android Emulator through standalone installation, not through VS Installer. It had to be installed there as well.

enter image description here

Mateusz Moska
  • 1,921
  • 1
  • 14
  • 18
  • 1
    The emulator was the problem. The latest update works fine for me. My problem was that I was using a Google emulator that looks like doesn't work fine with VS – Rodrigo Caballero Apr 18 '18 at 01:05
2

I had the similar issue, and then I deleted the existing device simulator and reinstalled again and it started working.

casillas
  • 16,351
  • 19
  • 115
  • 215
2

As I use a different SDK, in my case

Go to Tools > Options > Xamarin and set the Android SDK path.

Sometime Visual Studio changes this configuration;

Vítor Oliveira
  • 1,851
  • 18
  • 23
2

2020 Update: I followed the most voted comment, however, with Visual Studio 2019 updated recently, the steps have changed a little. Here is what previously worked:

  1. WHAT WORKED BEFORE

"Don't know if my issue was the same but finally this troubleshooting helped me to run emulator https://msdn.microsoft.com/en-us/library/mt228282.aspx#ADB. I was missing key Android SDK Tools with string value Path in registry Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node I've created it manually and it worked."

WHAT TO DO INSTEAD

Nothing. Don't mess with the path.

  1. WHAT WORKED BEFORE

"Before I got the issue with running emulator, I couldn't see it in Visual Studio. The reason was I've installed VS Android Emulator through standalone installation, not through VS Installer. It had to be installed there as well."

Previous instructions image

WHAT TO DO INSTEAD

a. Go to Tools located at the top of the VS window, Get Tools and Features, go to Individual components, using the search tool in the pop up box, search "emulator", once you get the result, make sure both Google Android Emulator (API Level 25)(local install) and Intel Hardware Accelerated Execution Manager (HAXM) (local install) are both checked.

b. Close the solution(s) and restart VS then reopen the solution(s).

c. To deploy the app on the emulator, click Start button to spin up the emulator, left click on your Android project, then click Deploy. You should be able to see your app on your emulator's app menu. Updated Instructions image

0
Worked for ME

Sometimes you close the android Emulator but not POWEROFF the Emulator. this problem happens when emulator shutdown un-properly.

Restart Your EMULATOR

  • First start your emulator
  • Then restart your emulator by pressing down the power button and select restart option in your android emulator.
Talha Rafique
  • 5,282
  • 1
  • 10
  • 11
0

I enabled Hyper-V acceleration based on microsoft documentations: https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?tabs=vswin&pivots=windows#accelerating-with-hyper-v

Basically you need to turn on these two windows features from the control panel (Turn windows features on of off):

  • Hyper-V.
  • Windows hypervisor platform.

then from visual studio go to: Tools >> Android >> Android SDK manager >> Tools >> make sure that "Android emulator" version is 27.0.1 or higher, if not, you will find in the same screen a button below to update it.

I did this on windows 10 64-bit, with VS 2017 Community 15.9.5