2

I've been going through all the possible solutions found here, unfortunately, none of them worked for me. My manifest is setup properly; I have 3 differents AVD's and all of them show the 3G logo at the top right corner. I'm working on an App that requires an Internet connection; I tried simply going on the internet with the browser and it doesnt work. I don't have a proxy; I'm connected into a router; I'm on Windows Vista. I've tried adding the DNS of my PC in Run Configuration. The only issue I can see that could have screwed things up (although as far I can remember it didn't work before) I've had to update manually the Tools folder when Eclipse asked up to update to SDK 19. I kept getting an error that Eclipse couldn't overwrite the Tools folder. That's the solution I found on Google; of course, I kept a copy of my original tools folder for back up.

Any suggestions?

Thanks!

Dan
  • 33
  • 4
  • 1
    Firewall? Did you try to disable it for a moment? And check out the LogCat - maybe it says something about Internet connection on your emulator – Michał Klimczak Apr 26 '12 at 22:56
  • 1
    Thanks for the help; the firewall didn't have anything to do with it, but I managed to find something else; I opened the prompt cmd; and entered this: emulator -avd(name of emulator) -dns-server 8.8.8.8 and it worked! Thanks again – Dan Apr 27 '12 at 12:41
  • I found your solution in many other threads, but I did it in eclipse's android -> launch, but it didn't help, but launching from command line really works. – Yaroslav Mytkalyk Oct 03 '12 at 08:21

1 Answers1

0

From developer.android.com:

At startup, the emulator reads the list of DNS servers that your system is currently using. It then stores the IP addresses of up to four servers on this list and sets up aliases to them on the emulated addresses 10.0.2.3, 10.0.2.4, 10.0.2.5 and 10.0.2.6 as needed.

On Linux and OS X, the emulator obtains the DNS server addresses by parsing the file /etc/resolv.conf. On Windows, the emulator obtains the addresses by calling the GetNetworkParams() API. Note that this usually means that the emulator ignores the content of your "hosts" file (/etc/hosts on Linux/OS X, %WINDOWS%/system32/HOSTS on Windows).

When starting the emulator at the command line, you can also use the -dns-server option to manually specify the addresses of DNS servers to use, where is a comma-separated list of server names or IP addresses. You might find this option useful if you encounter DNS resolution problems in the emulated network (for example, an "Unknown Host error" message that appears when using the web browser).

So, I really tried to run the emulator from the commandline:

$ emulator @Name_of_my_avd -dns-server 192.168.0.1

where 192.168.0.1 - is my home router's ip. I found in system settings, that 192.168.0.1 is also my DNS server.

Everything works!

UPD: For MacOS: go to the System Preferences -> Network -> Advanced (in your active connection's tab) -> DNS. You will see the list of DNS servers your system using (picture). When you edit this list and click Apply, your /etc/resolv.conf will update, so the emulator (without option --dns-server) will use it! BUT: in my case, emulator only use the first DNS server in the list! So if you want your emulator using some DNS server, simply make it the first DNS in the list.

kissed
  • 715
  • 6
  • 7