Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android SDK Connect to Web Server on Host

I am building a web service, and an android app to utilize it. I am doing both through Eclipse. When I'm running the web server locally, I can connect from my host machine's web browser at http://localhost:8888/. How can I connect to that from my android app running on the emulator on the same machine?

like image 892
Nicholas Hirras Avatar asked Feb 25 '23 23:02

Nicholas Hirras


1 Answers

How can I connect to that from my android app running on the emulator on the same machine?

If you are referring your localhost on your system from the Android emulator then you have to use http://10.0.2.2:8888/. Because Android emulator runs inside a Virtual Machine(QEMU) therefore here 127.0.0.1 or localhost will be emulator's own loopback address.

Refer: Emulator Networking

like image 163
Vikas Patidar Avatar answered Mar 08 '23 03:03

Vikas Patidar