none
Visual Studio Emulator for Android issues

    Question

  • My build is:

    Physical Computer, no virtualization software installed
    Windows 10 x64 Enterprise
    Visual Studio 2015 Enterprise

    Windows emulators work fine, can debug without issues.

    The problem arises with Android Emulators only. I can not start any of the Lollipop emulators (API 21 or 22). They just hang on the "OS is starting..." screen If I open HyperV they are sitting at the shell line after "failed to read from /dev/hw_random"...which I think means the emulator is running???

    If I remove the OpenGLGuestDisplay line from the xdesku document then the emulator is also stuck on the "OS is starting" screen but the VM in hyperv says "android".

    The KitKat emulators will run, but I cannot debug them. The app just opens and automatically closes.

    The same project on another machine can be debugged fine in KitKat and Lollipop.

    I tried everything, including rebuilding the machine. Literally installing Windows, then Visual Studio then testing. Same result.

    I installed windows 8.1, then visual studio then testing...the Lollipop emulator opens fine. Kitkat debugs fine.


    • Edited by Jason Zeleznik Tuesday, September 29, 2015 3:55 PM additional info
    Tuesday, September 29, 2015 2:04 PM

Answers

  • Hello Jason,

    Had exactly the same problem as you.
    My guess is that the problem is the new generation of processor you are using. Apparently the Hyper-V emulator fails while trying to load Android Api 21 or 22 virtual images.
    Workaround:
    - Open Hyper-V Manager
    - Select the Lollipop Emulator Virtual Machine
    - Click Settings
    - Expand "Processor", select "Compatibility"
    - Enable  "Migrate to a physical computer with a different processor version"

    Hope this helps!

    Saludos,

    Vladimir

    • Marked as answer by Jason Zeleznik Tuesday, October 13, 2015 4:48 PM
    Friday, October 09, 2015 5:17 PM

All replies

  • Hi

    >>If I remove the OpenGLGuestDisplay line from the xdesku document then the emulator is also stuck on the "OS is starting" screen but the VM in hyperv says "android".

    Do you mean that you could start the emulator well in Hyper-V manager?

    If it worked well in hyper-v manager, maybe we would think about the VS IDE or the windows Environment, could you re-install/repair the Emulator for Android?

    >>I installed windows 8.1, then visual studio then testing...the Lollipop emulator opens fine. Kitkat debugs fine.

    It worked well in windows 8.1 machine, but not work in the windows 10.1 machine, am I right?

    If so, what is your windows 10.1 machine's configurations? Did it meet the real requirements for Android developing?

    Could you delete the VM in hyper-v? And then re-run the app in VS, it would create a new one, how about the result?

    A document shares us some useful information about troubleshoot the Visual Studio Emulator for Android, if possible, you could view it here:

    https://msdn.microsoft.com/en-us/library/mt228282.aspx

    If you get any error message in your side, please feel free to share it here.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, September 30, 2015 10:25 AM
    Moderator
  • Whether the VM is started via Visual Studio Emulator for Android or directly through HyperV it has the same result....a bunch of lines ending with "Failed to read from /dev/hw_random: no such device" and then a couple blank lines down says "A N D R O I D shell@donatello:/$ which I believe means its "working"?

    I tried to repair Visual Studio and Visual Studio Emulator for Android, as well as uninstalling and reinstalling both.

    Yes it works in Windows 8.1 and not in Windows 10. Same Physical machine. Its a skylake core i5 (i5-6600) with 16GB of RAM and an M2 Hard drive.

    I tried deleting the VMs in hyperV, as well as deleting the virtual switches in HyperV and it recreates them but the problem persists.


    Wednesday, September 30, 2015 1:59 PM
  • Hi Jason,

    Thanks for your friendly response.

    >>Whether the VM is started via Visual Studio Emulator for Android or directly through HyperV it has the same result.

    If you mean that it still has this issue in the Hyper-V manager, I doubt that the real issue is not the VS IDE or VS setup issue since it loads the VM from the hyper-V manager, we would think about the hyper-V itself.

    >>Failed to read from /dev/hw_random: no such device.

    Please check that whether it is related to the OpenGL visualization.

    https://social.msdn.microsoft.com/Forums/en-US/d7c0bbc5-eb29-4080-8398-e55111d98c91/vs-android-emulator-cannot-boot?forum=visualstudiogeneral

    http://stackoverflow.com/questions/29802467/vs-2015-intern-android-emulator-not-starting-vmware

    Please check the requirement for the Hyper-v here:

    https://msdn.microsoft.com/en-us/library/mt228280.aspx#HyperV

    Or you could re-install the hyper-v, test it again.

    In addition, if still no help, you could discuss this issue(open a new case) with the hyper-V experts here:

    https://social.technet.microsoft.com/Forums/en-US/home?forum=winserverhyperv

    I think you could dedicated support from the hyper-v experts.

    Sincerely,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, October 01, 2015 7:18 AM
    Moderator
  • Like I mentioned earlier this is a physical machine, VMware is not involved.

    HyperV is clearly working since the Windows emulators load fine.

    Reinstalling HyperV does not solve the issue. Like I said I have reinstalled the emulators, visual studio and even windows and the problem remains.

    I believe the problem is the Visual Studio to emulator communication and/or XDE related. I can confirm that the emulator is not getting an IP address from DHCP.

    Thursday, October 01, 2015 3:23 PM
  • >>I believe the problem is the Visual Studio to emulator communication and/or XDE related. I can confirm that the emulator is not getting an IP address from DHCP.

    As far as I know, Each emulator is in one private network. The ip address 10.0.2.15 is only the private  network.

    This document shared some suggestions about how to set IP Address for Android Emulator:

    http://stackoverflow.com/questions/15350555/set-ip-address-for-android-emulator

    Maybe you could refer to it.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, October 02, 2015 10:20 AM
    Moderator
  • Not sure where you got the 10.0.2.15 from. From what ive read, Android Emulators from visual studio use DHCP to get their IP address (and confirmed it with this machine using KitKat and via other machines for lollipop). It uses 169.254.80.80 for the private communication to set up the emulator from what I can tell.

    Sunday, October 04, 2015 9:33 PM
  • Hi Jason,

    Thanks for your friendly response.

    Maybe I misunderstood this issue, but it seems that other members also got the simliar issue:

    http://stackoverflow.com/questions/32560853/app-not-run-in-visual-studio-emulator-for-android-in-visual-studio-2015

    To get the issue confirmed and diagnose by product team, would you please create connect report for it? You will get email notification for update.http://connect.microsoft.com/VisualStudio/feedback/CreateFeedback.aspx

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 05, 2015 10:49 AM
    Moderator
  • Thank you I have done that.

    This is incredibly annoying since I cannot proceed with Android Development efforts. This is after building a new computer, purchasing MSDN Visual Studio Enterprise and purchasing Xamarin Business for this exact purpose.

    Monday, October 05, 2015 9:50 PM
  • Hi Jason,

    Thank you for your support and co-operation.

    https://connect.microsoft.com/VisualStudio/Feedback/Details/1871745

    As you already submit one feedback on the Microsoft Connect site, let's focus on the case on that channel, may the senior members can provide more professional support, I will help you follow up this connect report.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 06, 2015 7:57 AM
    Moderator
  • Hello Jason,

    Had exactly the same problem as you.
    My guess is that the problem is the new generation of processor you are using. Apparently the Hyper-V emulator fails while trying to load Android Api 21 or 22 virtual images.
    Workaround:
    - Open Hyper-V Manager
    - Select the Lollipop Emulator Virtual Machine
    - Click Settings
    - Expand "Processor", select "Compatibility"
    - Enable  "Migrate to a physical computer with a different processor version"

    Hope this helps!

    Saludos,

    Vladimir

    • Marked as answer by Jason Zeleznik Tuesday, October 13, 2015 4:48 PM
    Friday, October 09, 2015 5:17 PM
  • Thanks Vlad, I was beginning to lose hope.

    So the long term answer would seem to have to include a patch for windows (hyper-v) or updated VMs from Microsoft?

    Tuesday, October 13, 2015 4:48 PM
  • Hi Jason,

    Glad I could help!

    Yes, it seems a patch or updated VMs are required.

    But so far, with this workaround, I was able to run the emulator and debug apps without any problems.

    Saludos,

    Vladimir


    Saludos, Vladimir

    Tuesday, October 13, 2015 5:02 PM
  • Hope this helps!

    Well 'twas very helpful to me. I'm here with my Windows 10 64bit, visual studio 2015 prof, xamarin installed. So some 6 months after your post there's still an issue... Your tip worked like a charm, thanks.

    Planet Earth, Europe, Denmark, Sealand, Copenhagen, Morten

    Thursday, April 14, 2016 8:52 PM
  • I have this exact problem on Windows 10, VS 2015 Update 3, and Xamarin 4.2.  In my case, Marshmallow emulator hangs. And all emulators that will run suffer from:

    "The KitKat emulators will run, but I cannot debug them. The app just opens and automatically closes."

    I've tried setting the migrate processor architecture for the emulators.  But the app still starts and immediately closes.  I've also tried disabling "fast deployment" and "use shared runtime" on the project.  But it hasn't helped.

    Anyone have a solution for this?


    Scott

    Monday, January 09, 2017 4:02 PM
  • I've have now spent more hours that I care to admit trying to get the VS Emulator for Android to work. I have tried just about everything I can find online in regards to my problem using both VS2015 or VS2017RC on Win10 Pro. Any help is greatly appreciated.

    .

    Tuesday, February 14, 2017 6:21 PM