[英]Android device cannot connect to localhost
I am developing an app for Android. 我正在为Android开发一个应用程序。 I have been happily developing it for a while, connecting the phone to the PC using a USB, using 192.168.xx as the address the code points to log in, etc. 我一直在愉快地开发它一段时间,使用USB将手机连接到PC,使用192.168.xx作为代码指向登录的地址等。
I started my IDE a couple of hours before, and without changing a single comma anywhere, I receive an Exception: 我在两个小时前启动了IDE,并且在任何地方都没有更改单个逗号的情况下,我收到异常:
10-21 17:15:04.177: W/System.err(24232): org.apache.http.conn.ConnectTimeoutException: Connect to /192.168.1.4:8080 timed out
10-21 17:15:04.177: W/System.err(24232): at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:121)
10-21 17:15:04.187: W/System.err(24232): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
10-21 17:15:04.187: W/System.err(24232): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
10-21 17:15:04.197: W/System.err(24232): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
10-21 17:15:04.197: W/System.err(24232): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
10-21 17:15:04.197: W/System.err(24232): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
10-21 17:15:04.197: W/System.err(24232): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
10-21 17:15:04.197: W/System.err(24232): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
10-21 17:15:04.197: W/System.err(24232): at myPackage.CustomHttpClient.executeHttpPost(CustomHttpClient.java:54)
10-21 17:15:04.197: W/System.err(24232): at myPackage.LoginActivity$3$1.run(LoginActivity.java:113)
i am getting mad... any help? 我生气了...有什么帮助吗? Thank you! 谢谢!
A very weird thing happened. 发生了一件非常奇怪的事情。 When I did ipconfig I would swear over the most sacred thing on earth i saw 192.168.1.4. 当我执行ipconfig时,我会发誓地球上最神圣的东西我看到192.168.1.4。 I did it more than one time, always saying 192.168.1.4. 我做了不止一次,总是说192.168.1.4。 After posting this question I did it again...and it showed 192.168.1.3. 发布此问题后,我再次进行了此操作……它显示为192.168.1.3。 i changed it in the Android app and now i am able to access server. 我在Android应用中对其进行了更改,现在可以访问服务器了。
Is there some time between an IP has changed and the ipconfig shows it? IP更改到ipconfig显示它之间是否需要一段时间? Because im SURE it said 192.168.1.4 the first 3 times I did it... 因为我确定我前3次说过192.168.1.4 ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.