Tuesday, January 4, 2011

Android: No Proxy

         When it comes down to Google, It has to be 'the' Best. Android, a mind blowing Mobile OS with staggering features. Building Applications on this platform is always fun. Most of the time, you need to work with the net. Everything goes fine, until, you get into the not-so-sophisticated problem of proxy servers for accessing internet.
          It came as a surprise for me, when i was unable to find proxy settings for the Android Emulator. After asking a few friends, I came to know, that I was searching for the non-existent! Android Emulator does not have a proxy settings option. How could a phone of such a caliber miss out on proxy settings.
          This, certainly, does not mean that the world has come to an end. The Android Emulator will set its proxy as well as "No-Proxy" fields from the environment variables. So just setting the environment variables does the trick.
          In Linux, open the ~/.bashrc, and set the http_proxy and no_proxy variables. Then run .bashrc. Voila !
          The following commands help

  • cd
  • sudo vim .bashrc
  • Add export http_proxy='proxy.server.example.com'
  • Add export no_proxy='127.0.0.1' #And other sites for which to bypass proxy-server.
  • . .bashrc
  • emulator -avd <name>
Now, Your Emulator runs under proxy as well. Enjoy and Happy Coding :)

No comments:

Post a Comment