Solution to : Android Emulator not connecting to internet even though there is internet connection on computer

For the past 2 days,I was boggled by my android emulator not connecting to the internet even though there was internet on my computer.Before going into quick fix,I would like to explain my scenario

My Scenario !!

Previously,there was proxy server at my office,and recently the proxy server was removed.Though I had unset all the proxy settings from my Lucid Linux,my android emulator was still using proxy settings.I came to know about this by running the emulator from terminal by using
emulator -avd laaptu2.3 -verbose
Here put your emulator name at laaptu2.3
At the terminal,it showed that the emulator is taking the my previous proxy settings.

Road to solution !!!

First I had to unset the proxy settings,that was still on my Ubuntu machine.This happened due to the fact,that while unsetting proxy settings,my Ubuntu machine wasn’t able to apply it system-wide even though I clicked apply system-wide option.The first place to unset proxy settings was from environment variables and you can edit environment variables via
sudo gedit /etc/environment
And remove all proxy settings options,if present there.Now,restart the computer.

Main Solution !!!

After starting your machine, start the emulator via the following ways
Step 1:
emulator -avd laaptu2.3 -dns-server -verbose
Emulator on dns server
adb server

Take a look at second picture and it may be possible that your adb server won’t start.First close the running emulator and execute following command on the terminal

adb kill-server
adb start-server
emulator -avd laaptu2.3 -dns-server -verbose

Here is the dns-server for,and after searching so many forums and solution,this method really works.

Step 2:
It may seem tedious to add always the dns server from terminal.So for that,you can set this parameter on eclipse and for that follow the steps

Go to run i.e. the green arrow sign on eclipse
Then navigate to run configurations
And a configuration window will be presented
Go to target
And finally to Additional emulator command line options

Eclipse additional command line

And apply the changes.Now your emulator can browse the internet.Above solution i.e. Main Solution works for Window machine too.Hope ,this saves time for some troubled developer.Have fun and enjoy 😉


8 thoughts on “Solution to : Android Emulator not connecting to internet even though there is internet connection on computer

  1. Man, I really REALLY appreciate your help on this. I had tried zillions of suggestions, spent hours trying to figure it out and ONLY this directions from you worked.

    Live longer and prosper !!
    Marcelo, from Rio city, Brazil.

  2. The greatest help i ever found on net.. this issues wasn’t even addressed well on stack-overflow… i just don’t know how to thank you brother.. hope i will also will be able to help someone out in the way you have done.. Worked like charm on Fedora 15 Lovelock 64bit with Tata photon connection.. just one thing.. should i always start adb server each time i reboot my machine??? Pleas do keep posting such helpful tips for Android devel.
    Thanks nd Regards,
    Dheeraj Suthar,
    Delhi, India.

  3. Dude, seriously.. the only guy who knows how to write this. ever one else is just writing “add a dns server” no one is bothering to write … thanks man

  4. Hello!
    I have Ubuntu 14.04 LTS and run an Android Emulator with Genymotion.
    I’m desperate, but it seems that maybe I can find a solution in your indications.
    I have two doubts, could you help me, please?
    How do I know which is my machine name?
    In the last step, how do I find this?:
    “Go to run i.e. the green arrow sign on eclipse
    Then navigate to run configurations”

    Thank you very much

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s