0

I am having problem to test my app using a device connect to my computer. I have connected my android phone to the machine and when i try to run the app i get this error. i can connect to my production server and emulator but cannot via my device.

http://10.0.0.20:8080/gate/action.do
I/System.out(2244): data.get(0)  username=almasi
No route to host
 java.net.SocketException: No route to host
 at org.apache.harmony.luni.platform.OSNetworkSystem.connect(Native Method)
 at dalvik.system.BlockGuard$WrappedNetworkSystem.connect(BlockGuard.java:357)
ZAJ
  • 793
  • 3
  • 23
  • 50

2 Answers2

2

It seems that your mobile and your PC are not on the same network, make sure that your android has IP that is on the same network as your PC e.g. 10.0.0.XXX.

It make sense that it work when you connect from the emulator or to the production server.

Check this question it is related to yours

Community
  • 1
  • 1
iTech
  • 18,192
  • 4
  • 57
  • 80
  • How can i find or know what ip my android is on or is it on the same network – ZAJ Feb 09 '13 at 06:49
  • 1
    see this question http://stackoverflow.com/questions/6064510/how-to-get-ip-address-of-the-device From the phone, just go to `Setting -> Wi-Fi -> Advanced` – iTech Feb 09 '13 at 06:52
0

Based on the errors you get, it seems that you are using a network operation to get connected to your local server and get the required data from the server. The above address(http://10.0.0.20:8080......) you gave probably might not work with devices, but it works perfectly with emulators. So trying with (http://Your.IP.Adress......) instead of (http://10.0.0.20:8080......) would solve your problem. If not repost your question with some code, so that there would be chances of having my answer edited. Moreover make sure your device has Wifi/high speed internet at least when testing. Hope this helps.

Kanth
  • 6,681
  • 3
  • 29
  • 41
  • 10.0.0.20:8080 this is the ip of my machine. on the emulator i change the ip to 10.0.2.2:8080 – ZAJ Feb 09 '13 at 06:45
  • IF you are on windows, just open the command prompt and type ipconfig--> press enter. you will find your PC IP Address something like xxx.xxx.x.xxx. So, then include this in your url http://xxx.xxx.x.xxx/ and try. – Kanth Feb 09 '13 at 06:55
  • i got this ip from ipconfig 10.0.0.20 – ZAJ Feb 09 '13 at 07:03