问题
My machine is using a WiFi connection for internet, and the LAN card is idle. it's not behind a proxy or firewall, but somehow, my emulator's browser isn't loading any page. meaning that the emulator can't connect to the internet.
I searched a lot but with no luck. what might be the possible reasons?
Please help.
Thanks in Advance!!
回答1:
I had the same problem with OS X. I have been working for 2 days now to get the emulator to connect to the internet, all solutions I have read so far (use -dns-server
, use proxy settings or disable unused netword devices) didn't work.
This morning I started the emulator with sudo ./emulator -avd my_avd_name
and it worked! Emulator was able to connect to the internet.
So there is something wrong with privileges or so, I need to figure this out. But it works for the moment.
回答2:
I have searched long and hard for an answer to this question. From what I gather Google did that on purpose once people started using emulators to add spam comments to the market. However, I did find a guy who had done it and was willing to share the required images.
NOTE: It looks like it's just going to fix the market. But the market won't run without internet, so if the market is fixed, the browser internet will work too. I downloaded the linked files myself and it showed the internet in the browser perfectly.
回答3:
In Windows, run the AVD Manager with administrator privileges. It worked for me.
回答4:
Open up a terminal on the development machine and trying resolving and pinging by name and by ip various known-good internet hosts.
Then open up an adb shell to the emulator and try the same things from there
回答5:
I don't know what happened, but I disabled the USB WiFi dongle and switched to a cabled network, and it started working. don't know what the reasons were, but I am happy now that it worked.
May be this is useful to others too!
回答6:
I have Disable all the other WiFi & LAN connections. Make only single connection enable, with which you have to work with. [Check the connections from "Network Connections"] & Restart the machine works for me.
回答7:
Just right click your eclipse.exe file and click "run as administrator" then whenever emulator will start from eclipse while running your app then you will be able to access internet inside it..it will use host's internet so that should be on..if you are using command line environment then do same with your command prompt ..(this is for windows)..there is no need of proxy or dns setting etc..i dont know about other platforms but it worked for me in windows.. hope this helps :)
来源:https://stackoverflow.com/questions/4104675/emulator-unable-to-connect-to-internet