{"id":9642,"date":"2017-04-17T18:24:55","date_gmt":"2017-04-17T17:24:55","guid":{"rendered":"http:\/\/www.itwriting.com\/blog\/?p=9642"},"modified":"2017-04-17T18:24:55","modified_gmt":"2017-04-17T17:24:55","slug":"microsoft-needs-to-fix-its-android-emulator","status":"publish","type":"post","link":"https:\/\/www.itwriting.com\/blog\/9642-microsoft-needs-to-fix-its-android-emulator.html","title":{"rendered":"Microsoft needs to fix its Android emulator"},"content":{"rendered":"<p>Microsoft wants Windows 10 to be an ideal developer operating system, with its Linux subsystem, and Visual Studio 2017 is notable for its strong cross-platform development tools. <\/p>\n<p>There is an annoyance though. Google\u2019s Android SDK includes an emulator for debugging mobile applications, but it requires hardware acceleration in the form of Intel\u2019s HAXM (Hardware Accelerated Execution Manager). Otherwise you get an error as below:<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2017\/04\/image.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2017\/04\/image_thumb.png\" width=\"244\" height=\"165\" \/><\/a><\/p>\n<p>Unfortunately this is incompatible with Hyper-V, the hypervisor built into Windows. You cannot fix this by stopping Hyper-V services; it is set when Windows boots.<\/p>\n<p>Hyper-V is increasingly important for general Windows developers. It is not only useful for running up VMs on which to test stuff, but also for the official Docker tools and testing Windows containers.<\/p>\n<p>The solution should be to use the Visual Studio Emulator for Android. This is based on Hyper-V so no problem.<\/p>\n<p>Unfortunately it does not currently work very well. On one of my PCs it starts, but without internet connectivity, rendering it useless for many apps. On another PC it does not start at all.<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2017\/04\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2017\/04\/image_thumb-1.png\" width=\"244\" height=\"143\" \/><\/a><\/p>\n<p>I spent a bit of time trying to get it to work. The networking problem seems to be related to conflicts with other applications using Hyper-V. Specifically, the Visual Studio Emulator for Android uses two Hyper-V virtual network adapters, one connected to the Windows Phone Emulator Internal Switch, and the other connected to an external virtual switch. This second adapter gets its network settings using DHCP (there is no way to change this). The emulator app proxies internet connections from the internal to the external network.<\/p>\n<p>The reference to Windows Phone comes about because this is essentially the Windows Phone emulator adapted to run Android.<\/p>\n<p>In my Hyper-V setup I have another internal switch, called DockerNAT, used by the Docker tools, as well as a third internal switch which I\u2019ve used for other things. In the emulator\u2019s network settings I can actually see four Desktop Adapters (in addition to the primary \u201cEmulator adapter\u201d, of which only one has internet connectivity via my business network. I theorised that the emulator is attempting to proxy via the wrong adapter, and disabled the others in Control Panel \u2013 Network Connections. However it still does not connect.<\/p>\n<p>Judging by posts like <a href=\"http:\/\/stackoverflow.com\/questions\/13159947\/windows-phone-8-emulator-cant-connect-to-the-internet\" target=\"_blank\">this<\/a> and <a href=\"https:\/\/blogs.msdn.microsoft.com\/wsdevsol\/2013\/10\/01\/why-cant-the-windows-phone-emulator-go-online\/\" target=\"_blank\">this<\/a>, there may be some cocktail of settings in Hyper-V and in Control Panel that gets this working. Bear in mind though that I want everything else to work too.<\/p>\n<p>I also note that Windows developer evangelist Scott Hanselman <a href=\"https:\/\/www.hanselman.com\/blog\/SwitchEasilyBetweenVirtualBoxAndHyperVWithABCDEditBootEntryInWindows81.aspx\" target=\"_blank\">suggests<\/a> setting up a dual boot arrangement so that you can boot with HAXM enabled when you want to develop on Android, and with Hyper-V otherwise \u2013 implying that there is no other easy fix.<\/p>\n<p>This works, though it is a dreadful solution. Rebooting is not only time-consuming, but disruptive to the flow of your work, and having to reboot with special settings just to work on Android is painful.<\/p>\n<p>It strikes me that this could be fixed with a bit of effort. If Microsoft is serious about persuading developers to use Windows 10, Visual Studio and Xamarin for cross-platform mobile apps, that would be a good idea.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft wants Windows 10 to be an ideal developer operating system, with its Linux subsystem, and Visual Studio 2017 is notable for its strong cross-platform development tools. There is an annoyance though. Google\u2019s Android SDK includes an emulator for debugging mobile applications, but it requires hardware acceleration in the form of Intel\u2019s HAXM (Hardware Accelerated &hellip; <a href=\"https:\/\/www.itwriting.com\/blog\/9642-microsoft-needs-to-fix-its-android-emulator.html\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Microsoft needs to fix its Android emulator<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,55],"tags":[143,586,955],"class_list":["post-9642","post","type-post","status-publish","format-standard","hentry","category-android","category-microsoft","tag-android","tag-microsoft","tag-visual-studio"],"_links":{"self":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/9642","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/comments?post=9642"}],"version-history":[{"count":0,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/9642\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/media?parent=9642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/categories?post=9642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/tags?post=9642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}