Usually I use linux with squid as a proxy server on the same PC and the Android emulator does not connect to internet returning the error “Web page not available” as in Figure 1.
To set up squid as a proxy for the emulator you can not use 127.0.0.1 as the IP address because for the emulator it is the address of the mobile device and not the localhost.
On the site Android Developers I found the following page Using the Android Emulator where you read:
“Also note that the address 127.0.0.1 on your development machine corresponds to the emulator’s own loopback interface. If you want to access services running on your development machine’s loopback interface (a.k.a. 127.0.0.1 on your machine), you should use the special address 10.0.2.2 instead.”
Then to configure the Android emulator to use the squid proxy server on the localhost go to:
Menu -> Settings -> Wireless & networks -> Mobile networks -> Access Point Names -> TelKila
where you set Proxy to 10.0.2.2 and Port to 3128 as in Figure 2.
Alternatively you can enter in the menu of Eclipse, Run Configurations, as Additional Emulator Command Line Options, -http-proxy http://10.0.2.2:3128 as in Figure 3.
With this second method I get an error starting the emulator in the Eclipse console:
emulator: Could not connect to proxy at 10.0.2.2:3128: Connection timed out !
emulator: Proxy will be ignored !
but everything seems to work properly.
Leave a Reply