What is the IP address of android emulator, by what I found SEVERAL information on the internet, 127.0.0.1, 10.0.0.2 or 10.0.015 to call the emulator from web server (apache). is that the port of the emulator is fixed?
Asked
Active
Viewed 2.1k times
4
-
[10.0.2.2](http://developer.android.com/tools/devices/emulator.html#emulatornetworking) – Laksh Apr 16 '13 at 09:57
-
The question is, _which_ IP address of the AVD do you need, as it is hidden between a software router on the host. – class stacker Apr 16 '13 at 10:17
5 Answers
8
10.0.2.1
- Router/gateway address10.0.2.2
- Special alias to your host loopback interface (i.e.,127.0.0.1
on your development machine)10.0.2.3
- First DNS server10.0.2.4
/10.0.2.5
/10.0.2.6
- Optional second, third and fourth DNS server (if any)10.0.2.15
- The emulated device's own network/ethernet interface127.0.0.1
- The emulated device's own loopback interface

Nofate
- 2,714
- 3
- 32
- 32

Piyush Machhoya
- 99
- 4
-
thanks @piyush-machhoya, the url to ip address is https://developer.android.com/studio/run/emulator-networking.html – Bakhshi May 04 '17 at 00:55
5
Use this method you will be getting 100% correct ip address for your android emulator
To get the ip address of yoor emulator
Go to adb shell and type this command
adb shell
ifconfig eth0
After running this command I am getting
IP : 10.0.2.15
Mask : 255.255.255.0
Which works for me . I am also working for an networking application.

Nikhil Agrawal
- 26,128
- 21
- 90
- 126
-
2If `ifconfig eth0` doesn't work, just try `ifconfig` and you'll likely find it under "wlan0". – OJ7 Sep 05 '19 at 15:27
0
-
7Folks, please stop upvoting this. Heven't you ever started several AVDs at the same time? From that alone it must be clear that this answer must obviously be insufficient. Or have you ever had an IP address conflict when you started several AVDs? I haven't. – class stacker Apr 16 '13 at 10:06
-
10.0.2.2 is the IP address of the machine running the emulator as @Piyush Machhoya mentions. It is not the emulated devices IP. – Doug Aug 11 '17 at 00:52
0
Use adb shell
from command line to log-in in your device and run netcfg
to see its network configuration. Now you are also future-proof. Don't give a man a fish.. Teach him how to fish :D

baske
- 1,316
- 9
- 16
-1
Try to look for "HttpHost" class. http://developer.android.com/reference/org/apache/http/HttpHost.html

sıkıntıyok
- 11
- 3