Not able to connect to Internet from Visual Studio

2019-01-25 08:30发布

问题:

I just installed VS 2015 RC and opened up the VS emulator for Android. I am not able to connect to internet from this emulator. I went to settings -> WiFi and could see its turned on, but not showing as connected to any network. Upon turning off the wifi and turning it on, I could see the status as "Connecting".

How do I configure this emulator to access internet ?

回答1:

I had to just disable the VirtualBox Host-Only Network adapter, which Genymotion emulators under VirtualBox used (Control Panel - Network and Internet - Network Connections on Windows 10), then restart the emulator and it works like a charm.

Greg



回答2:

If you use Wifi to connect to internet. Just go to Run and search Hyper-v manager so run it. Select your emulator from virtual machines section right clicking on it go to settings . You see some adapters . we need seconed item external network. so change it to your Wifi adapter. go to your emulator and google Iman Mohadesi. it works. just it.



回答3:

Put away your shotguns folks. The key to solving this is a complete understanding of the problem. The VS Android Emulator is not configured out of the box with an external network connection. (Why? Why? Why?). The only network adaptor it has (Window Phone Emulator Internal Switch) is (as it name says) internal, that is not connected to the internet. It is only used (apparently) for communicating with the host.

So to have internet connection we need to add another virtual adaptor and connect it on the host system to the internet.

See this blog post to add and configure adaptor: http://blog.tpcware.com/2017/03/visual-studio-2017-android-emulation/

Overview:

  1. In Hyper-V Manager add a new Virtual Switch. Name it External. See that it is connected to your real network connection.
  2. In the virtual machine settings for the Android emulator, add a new network adaptor (emulator must be stopped to do this). Select the newly created external virtual switch.
  3. Start emulator and open browser. Voila! You now have internet access.

So please disregard all the advice about rebooting, repairing, re-installing, etc. This is all a complete waste of time. I am astonished that some folks report this fixes the internet connectivity.

One last thing. The blog post says that this approach does not work if you network adapter is wireless. It works find for me and I only have a wireless connection from my laptop.



回答4:

This solved my issue. there must be an internal and external network with the external listed after the internal. Use Hyper-V manager to fix these up on all your VS Emulators VMS.

No internet connection for Visual Studio Android Emulator



回答5:

I only use Hyper-V and for some reason, all my Android emulators failed to connect to internet. To resolve this, go to Hyper-V Manager -> Virtual Switch Manager (on the right side of the window) and remove the corresponding virtual switch, in my case the Wireless. Finally in Visual Studio, run the app with any of the emulators and wait till finish its re-install the virtual switch.



回答6:

In my case, I had the wifi enabled instead of ethernet (The cable was accidentally unplugged). pluggin it back solved the problem.



回答7:

this link enter link description here saved my a lot of times. Hope this help for you.