此错误仅在模拟器上发生,但完全在移动设备上运行...
错误
07-30 05:38:09.024: E/AndroidRuntime(941): android.os.NetworkOnMainThreadException
07-30 05:38:09.024: E/AndroidRuntime(941): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
07-30 05:38:09.024: E/AndroidRuntime(941): at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84)
07-30 05:38:09.024: E/AndroidRuntime(941): at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
07-30 05:38:09.024: E/AndroidRuntime(941): at libcore.io.IoBridge.connect(IoBridge.java:112)
07-30 05:38:09.024: E/AndroidRuntime(941): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
07-30 05:38:09.024: E/AndroidRuntime(941): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
07-30 05:38:09.024: E/AndroidRuntime(941): at java.net.Socket.connect(Socket.java:842)
07-30 05:38:09.024: E/AndroidRuntime(941): at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
07-30 05:38:09.024: E/AndroidRuntime(941): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
07-30 05:38:09.024: E/AndroidRuntime(941): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
07-30 05:38:09.024: E/AndroidRuntime(941): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
07-30 05:38:09.024: E/AndroidRuntime(941): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
07-30 05:38:09.024: E/AndroidRuntime(941): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
07-30 05:38:09.024: E/AndroidRuntime(941): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
07-30 05:38:09.024: E/AndroidRuntime(941): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)