Visual Studio Android Emulator won't run appli

2020-07-05 06:10发布

问题:

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?

回答1:

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/



回答2:

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.

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.



回答3:

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



回答4:

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;



回答5:

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.


回答6:

I enabled Hyper-V acceleration based on microsoft documentations: https://docs.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