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.
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.
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.
I think you want 10.0.2.2. Check out the Android Emulator Networking documentation: https://developer.android.com/studio/run/emulator-networking.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With