Android 2.1 Emulator Without Internet Connection

2019-09-05 07:21发布

问题:

I have no Internet access in my Android Emulator.

The app I am developing needs Internet connection, but the Android Emulator have no internet connection. I also tried to use the native browser of the emulator, but it also does not work. When I export my app to a real android, it works just fine.

I already tried to press F8 to turn on and off the "3G connection" in the emulator.

I already turned off the Windows Firewall, but it didn't work.

Data: Windows 7 x64 Eclipse Plugin for Android Android version 2.1

回答1:

Try recreating the emulator instance. Sometimes the instances get corrupted and you get weird behavior like the one described by you above. The internet connection should work without any interaction in a fresh emulator instance.

If you are behind a firewall or you are using a proxy then things can get a bit more complicated but there are workarounds for those situations also.



回答2:

Don't keep re-creating new instances of the same emulator. I had this problem before and created a brand new emulator (same settings as the other one), and it worked fine for some reason.



回答3:

I had to set manually the DNS Server of my emulator.

To do that:

Within Eclipse I went to Run Configurations -> Target and added "-dns-server X.X.X.X" and everything worked fine afterwards. (obviously X.X.X.X was the IP address for my DNS server).

so i put this line: -debug-slirp -dns-server 192.168.178.1