Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can an android emulator contact the host developing machine in eclipse?

I have a normal simple java program running as a server, waiting for a client to connect with TCP.

On another eclipse project, i'm building an android application. That application has to contact the java program running on the host machine to receive a message.

I can't simply use "localhost" to contact the server becouse, supposedly, the emulator runs behind a virtual router and i'll be accessing the "phone"'s network instead of the host machine's network.

So, what ip should I use to contact the host development machine?

The machine is a linux running on a VirtualBox with an Ip of 10.0.0.5. I've tried to use that ip on the emulator but even so, I can't establish a connection.

like image 573
user1378063 Avatar asked Dec 07 '12 01:12

user1378063


People also ask

How to stop Android emulator?

Run and stop an emulator, and clear data To stop a running emulator, click Menu and select Stop. To clear the data for an emulator, select Wipe Data. Or click Menu and select Wipe Data.

Does Eclipse have emulator?

In order to run an instance of the emulator, you must create an AVD. To create an AVD from Eclipse: Select Window > Android SDK and AVD Manager, or click the Android SDK and AVD Manager icon in the Eclipse toolbar. In the Virtual Devices panel, you'll see a list of existing AVDs.


1 Answers

I think you want 10.0.2.2. Check out the Android Emulator Networking documentation: https://developer.android.com/studio/run/emulator-networking.html

like image 100
Nagesh Susarla Avatar answered Oct 21 '22 13:10

Nagesh Susarla