Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I let android emulator talk to the localhost?

I'm running an android app on the emulator. This app tries to load a html file using the webview api.

I also have a simple http server running on the same computer under the directory where I want to serve the request using the following python command:

python -m SimpleHTTPServer 800

However, I couldn't access this link through either the app or the browser on the emulator:

http://localhost:800/demo.html

Please let me know if I'm missing something.

like image 278
Vicky Avatar asked Mar 03 '11 18:03

Vicky


1 Answers

Use address 10.0.2.2 instead of localhost.

like image 66
Piva Avatar answered Nov 15 '22 00:11

Piva