How can I connect my Android emulator to the internet, e.g. to use the browser? I\'ve found lots of advice on what do to when your connected through a proxy, but that\'s not
I'm not sure if this is your issue, but here's how I fixed mine.
I always had this "No DNS servers found" error when starting the emulator and did a lot of research on google to no avail. Anyway, I found a post somewhere (can't find it anymore) that was saying that the number of NICs, number of DNS entries could affect the emulator. Also, knowing that the emulator uses a Windows API function (GetNetworkParams()) to resolve DNS entries, I couldn't rely on the %WINDOWS%\System32\Hosts file.
However, I did went in the NICs properties (on Windows 7) to find that I was specifying a static IP, but no DNS entries. So, I got the DNS entries from my router and plugged them in the NICs property. I restarted the emulator and it is now using the correct DNS entries!
I can use my internet connection with the emulator now, and it works wonders!
Hope it helps!
If you are on Mac - try this -
it appears there might be a few reasons why there might be no internet connection for an emulator, in my case i was working from home where i have a wireless connection then came into the office and plugged in direct, however although my wireless connection was disconnected it was not disabled resulting in no emulator connection. my understanding is that when it starts up it looks for a network adapter and if there is any conflict here it might result in no internet connection. to resolve go to Start > Settings > Network Connections right click on Wireless Network Connection (if you are not using wireless) and select disable
My platform: Mac OS 10.6.4 Eclipse: 3.6
I had a similar problem where my map app background was grey (no tiles) and the browser was unable to connect to the internet.
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).
[EDIT]
For more recent version of Android Studio, the emulator you need to use is no longer in the ~/Library/Android/sdk/tools
folder but in ~/LibraryAndroid/sdk/emulator
.
If while trying the below solution you get the following message "PANIC: Missing emulator engine program for 'x86' CPU.”, then please refer to https://stackoverflow.com/a/49511666 to update your bash environment.
Operating System : Mac OS X El Capitan
IDE : Android Studio 2.2
For some reasons, I wasn't able to access internet through my AVD at work (probably proxy or network configuration issues). What did the trick for me was to launch in command line my AVD and giving manually the Google public DNS 8.8.8.8.
In your Terminal go to the folder tools of your Android sdk to find the 'emulator' program:
cd ~/Library/Android/sdk/tools
Then retrieve the name of your AVDs :
emulator -list-avds
It will return you something like this:
Android_Wear_Round_API_23
Nexus_10_API_22
Nexus_5X_API_22
Nexus_5X_API_24
Nexus_9_API_24
Then launch the AVD you would like with the following instructions:
emulator -avd NameOfYourDevice -dns-server 8.8.8.8
Your AVD is launched and you should be able to use internet.
I think sometimes it's just enogh to simply restart the virtual device. :-)