I started using xamarin in visual studio, and I installed visual studio android emulator. Emulator works flawlessly, but network on it doesn't. In settings it says it's connected, but browser can't open websites. I started windows phone emulator, and there network works without problem. When I started android emulator, it added two network adapters (see picture). In hyper-v virtual device settings for Android emulator, internal network adapter is set to windows phone adapter (see on picture), and external is set to Realtek bla bla bla. I tried deleting all virtual switches, deleting emulator and going all over again, and nothing helps. I assume the problem is in android emulator or hyper-v settings, because windows phone emulator works all right (it uses same internal adapter, but has no external in hyper-v settings). Does anyone have idea how to solve this? Thanks in advance!
问题:
回答1:
Seems like the installation of the Visual Studio Emulator for Android might have gone wrong. You can check the Network settings in the Hyper-V manager.
For the two images I use it looks like this
Internal Network Adapter
External Network Adapter
So the problem might be something with the External setting as it can't connect to the Internet.
I see you have a virtual switch which is similar to the one I have for my Intel NIC. If you go to Virtual Switch Manager in the options menu on the right, the Virtual Switch Properties for your virtual switch should look like this:
回答2:
I just went through the same problem. First, do you have LAN and WiFi on your computer/laptop. If you do test it out by disabling the LAN in your Network settings or Computer hardware manager and connecting through WiFi. If that works then you have the same problem I had. This is caused because the Hyper-V Network Switch setup for the Android Emulator prefers to use the WiFi Connection of your computer when it sets up the Network Switch.
Solve this by:
Uninstalling the Android Emulator from Visual Studio.
Go into Hyper-V and delete the "VS Emulator..." VMs and the extra Virtual Network Switches created by the Android Emulator
Disable your WiFi so you are ONLY connected by LAN
Reinstall the Visual Studio Android Emulator
Run Emulator and agree to let it setup the internet for you.
Test the Emulator is connected to the internet by LAN.
Shutdown the Emulator and re-enable your WiFi.
Run the Emulator again and let it setup the internet for you again.
You can now re-enable your LAN or use your WiFi.