0

I have an android app that should connect to my Webserver Xampp via php script. Its working fine on emulator but not on my phone device htc desire x.

I got this error:

07-12 09:01:40.330: W/System.err(30827): org.apache.http.conn.HttpHostConnectException: Connection to 10.0.2.2 refused
07-12 09:01:40.330: W/System.err(30827):    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:183)
07-12 09:01:40.330: W/System.err(30827):    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
07-12 09:01:40.330: W/System.err(30827):    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
07-12 09:01:40.330: W/System.err(30827):    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:367)
07-12 09:01:40.340: W/System.err(30827):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:593)
07-12 09:01:40.340: W/System.err(30827):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:510)
07-12 09:01:40.340: W/System.err(30827):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:488)
Grzegorz Żur
  • 47,257
  • 14
  • 109
  • 105
Kim
  • 1
  • Perhaps the problem is the ip address? – Simon Jul 12 '13 at 10:43
  • thanks for the answer. I try it also with the ip address, its working fine on emulator but not on my phone. – Kim Jul 12 '13 at 10:45
  • Does this XAMPP-Server run on your PC? If it´s only running locally, how should your phone be able to connect to it? – Benjamin Schwalb Jul 12 '13 at 10:49
  • thanks Benjamin..you have right... It doesn't run on my PC. I got the message: Access denied. – Kim Jul 12 '13 at 11:22
  • @ Benjamin: Now I have connected my device to Eclipse and want to test my app directly on device instead of Emulator. The application (a Login System) runs on my device, but when I click on login button,it gives force close error. I got the same error which I have mentioned before. – Kim Jul 16 '13 at 07:56
  • Now my application runs on my device htc desire x. :) This link (the answer from codemonkey) http://stackoverflow.com/questions/9887621/accessing-localhost-of-pc-from-usb-connected-android-mobile-device/17603378#17603378 help me to resolve my problem. – Kim Jul 16 '13 at 10:08

0 Answers0