How can I get my android emulator use my computer's VPN interface?

umassthrower picture umassthrower · Aug 4, 2011 · Viewed 38.2k times · Source

My company requires VPN to connect to our dev systems and for the first time I'm trying to work on an android app from home. Turns out the emulator doesn't want to use the VPN interface so even though I have connectivity to our dev systems on my VPN-connected laptop the emulator that's running on it does not.

I have thought of 3 solutions to this:

  1. run a VPN client on the emulator, but I was hoping for a simpler solution than that
  2. setting up a proxy server on my local machine
  3. forwarding a port on my local machine

2 and 3 can probably work, but I'd still like to know if there is an easy way to get the emulator to use the VPN interface without a workaround.

I'm running OS X 10.7 and I've already tried adjusting the interface priority order with network>>set service order.

I suppose I can dust off the old dell and try it there, but I would expect the same results.

Answer

Ciro Huang picture Ciro Huang · May 10, 2013

First start your vpn connection and then restart the emulator, now the emulator should use the host vpn connection.

it's mostly because of the DNS issue, according to the android doc:

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.