android httpclient localhost Connection refused

来源:互联网 发布:分手后还能做朋友知乎 编辑:程序博客网 时间:2024/04/29 03:02
Simulator through the android simulator debugging link localhost or 127.0.0.1, but the error it! !

Exception 1: java.net.ConnectException: localhost/127.0.0.1: 8080 -
Connection refused

The problem is this, android emulator (simulator) to its own as a localhost, that is, the code used to access localhost or 127.0.0.1, is access to the emulator yourself! This is not work!

Simulator in the simulator if you want to access your computer above, then use the built-in IP10.0.2.2 android it, 10.0.2.2 is the simulator to set a specific ip, is your computer's alias alias

Remember that the emulator to access your computer using 10.0.2.2 local
0 0