Monday, October 10, 2011

Android: Has anyone solved the localhost HttpClient Connection Refused error

Error:

Android: Has anyone solved the localhost HttpClient Connection Refused error.

What is the solution for the above problem?

Solution

Since you have not specified your are connecting to server from device or emulator and I guess you are using your application in emulator.
If you are referring your localhost on your system from the Android emulator then you have to usehttp://10.0.2.2:8080/. Because Android emulator runs inside a Virtual Machine(QEMU) therefore here 127.0.0.1 or localhost will be emulator's own loopback address.

No comments: