Starting Android Emulator with AVD
- February 4, 2017
Starting emulator with Visual Studio 2017 RC error -
“Starting emulator for AVD 'Phone_x86_ToolsForApacheCordova'emulator: ERROR: x86 emulation currently requires hardware acceleration!Please ensure Intel HAXM is properly installed and usable.CPU acceleration status: Please disable Hyper-V before using the Android Emulator.
Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.”
C:\Program Files (x86)\Android\android-sdk\extras\intel\Hardware_Accelerated_Execution_Manager >intelhaxm-android.exe Disable Hyper V - dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
Installation Instructions for Intel® Hardware Accelerated Execution Manager (Intel® HAXM) - Microsoft Windows*
At this point, I felt that it must have been disabled in my BIOS. Taking another moment I started looking for the Visual Studio Android emulator (this is the one that I had used after Xamarin Player was deprecated. I found that I could start this manually by searching for Visual Studio Emulator for Android.
It would start fine but Visual Studio would not allow me to deploy to it. I went back to the Visual Studio 2017 installer and then found an individual component “Visual Studio Emulator for Android” that was not installed. I selected and proceeded to install. You can follow these instructions on how to find the 2017 installer
Now after above installation it found on the Tools menu
Launch – so I returned to my simple template App and hit debug run with “7 KitKat (4.5)..” emulator. This time the Visual Studio Android emulator started. This is small progress. Watching the Output window however I noticed the following error.
02-04 12:47:32.605 D/Mono ( 1267): AOT module 'mscorlib.dll.so' not found: dlopen failed: library "/data/app-lib/App1.Droid-2/libaot-mscorlib.dll.so" not found02-04 12:47:32.605 D/Mono ( 1267): AOT module '/Users/builder/data/lanes/4009/3d959b66/source/monodroid/builds/install/mono-x86/lib/mono/aot-cache/x86/mscorlib.dll.so' not found: dlopen failed: library "/data/app-lib/App1.Droid-2/libaot-mscorlib.dll.so" not found02-04 12:47:32.621 D/Mono ( 1267): Config attempting to parse: 'mscorlib.dll.config'.02-04 12:47:32.621 D/Mono ( 1267): Config attempting to parse: '/Users/builder/data/lanes/4009/3d959b66/source/monodroid/builds/install/mono-x86/etc/mono/assemblies/mscorlib/mscorlib.config'.02-04 12:47:32.677 D/Mono ( 1267): Assembly mscorlib[0xb85ce5c0] added to domain RootDomain, ref_count=1Could not connect to the debugger.
At least now, the Android emulator started and it would deploy to the device. I also could run the App on the device. So why would the debugger not attach?
I disabled “Fast Deploy” and retried. Well it would deploy the app but again the debugger was not attached.
Looking at the Hyper-V manager
Reading the reference blog indicated that I need to ‘Migrate to a physical computer with a different processor version” Reference:
Retrying [>] Debug run the emulator within Visual Studio 2017, the emulator started correctly..waiting..’is the debugger going to attach?’..suspense now waiting for the build-deploy process. And as the above reference article mentioned Visual Studio was stuck in the preparing stage.
It recommended that internet connection sharing enabled, so I would need to figure out how/where to disable/enable ‘Internet Sharing’ Using “services.msc” I found ‘Internet Connection Sharing” mine was set to Manual (Trigger Start) –which should be ok? Oddly, I was stuck here and had no idea why it was stuck in the deploy phase. After another hour I enabled by WIFI on my pc. I had it disabled to ensure I was connected via hard-wire.
Well once I enabled WIFI, then closed the emulators and restarted it all started working, and I could step through my Xamarin Forms app once again with Visual Studio 2017.