How do I specify which network interface an Android emulator should use on my development machine?

My development machine is simultaneously connected to two different networks. One is via ethernet (eth0), and the other is WiFi (en1). In this situation, the Android emulator seems to always want to connect to the network on eth0. When you start the emulator from the command line, is there an option where I can tell her to use a specific network interface on the development machine (en1 in my case)?

It seems that this should be possible via args, you can go to the -qemu icon. However, the current version of the emulator will not start when using this flag.

+8
android android-emulator networking
source share
2 answers

If you are only communicating with a specific address or subnet, you can configure a suitable route on the host machine using the add route command. The syntax is slightly different for Windows and Linux:

Linux

route add -net target-ip netmask 255.255.255.0 metric 1 gw en1

Window

route add target-ip mask 255.255.255.0 en1-gw-address metric 1 -p

You may need to configure the netmask value (255.255.255.0) for your needs.

+5
source share

IMHO this is not possible, because the emulator uses a virtual router, and not the physical network interface of your development PC

Take a look at this link - there is detailed information about this http://developer.android.com/guide/developing/devices/emulator.html#emulatornetworking

+1
source share

All Articles