Access host computer from Android emulator

Posted: January 17, 2014 in Android

The answer is very simple, 10.0.2.2 is the special alias to your host loopback interface (i.e., 127.0.0.1 on your development machine). So if you have a web server hosting in your local machine, you can just access it from the emulator via http://10.0.2.2/

For more information, you can reference to emulator networking in http://developer.android.com/tools/devices/emulator.html#emulatornetworking.

If you also want to access your other development machine from the emulator, you may either modify the emulator host file, or set the emulator DNS to your own one. You can refer to my previous post How to Modify Android Emulator Hosts file

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s