android运行时出错

冷玉 发布于 2012/12/17 09:43
阅读 4K+
收藏 0

12-17 01:16:35.090: D/AndroidRuntime(775): Shutting down VM
12-17 01:16:35.090: W/dalvikvm(775): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
12-17 01:16:35.230: E/AndroidRuntime(775): FATAL EXCEPTION: main
12-17 01:16:35.230: E/AndroidRuntime(775): com.caucho.hessian.client.HessianRuntimeException: android.os.NetworkOnMainThreadException
12-17 01:16:35.230: E/AndroidRuntime(775):  at com.caucho.hessian.client.HessianProxy.sendRequest(HessianProxy.java:297)
12-17 01:16:35.230: E/AndroidRuntime(775):  at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:160)
12-17 01:16:35.230: E/AndroidRuntime(775):  at $Proxy0.Login(Native Method)
12-17 01:16:35.230: E/AndroidRuntime(775):  at android.view.View.performClick(View.java:4084)
12-17 01:16:35.230: E/AndroidRuntime(775):  at android.view.View$PerformClick.run(View.java:16966)
12-17 01:16:35.230: E/AndroidRuntime(775):  at android.os.Handler.handleCallback(Handler.java:615)
12-17 01:16:35.230: E/AndroidRuntime(775):  at android.os.Handler.dispatchMessage(Handler.java:92)
12-17 01:16:35.230: E/AndroidRuntime(775):  at android.os.Looper.loop(Looper.java:137)
12-17 01:16:35.230: E/AndroidRuntime(775):  at android.app.ActivityThread.main(ActivityThread.java:4745)
12-17 01:16:35.230: E/AndroidRuntime(775):  at java.lang.reflect.Method.invokeNative(Native Method)
12-17 01:16:35.230: E/AndroidRuntime(775):  at java.lang.reflect.Method.invoke(Method.java:511)
12-17 01:16:35.230: E/AndroidRuntime(775):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
12-17 01:16:35.230: E/AndroidRuntime(775):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-17 01:16:35.230: E/AndroidRuntime(775):  at dalvik.system.NativeStart.main(Native Method)
12-17 01:16:35.230: E/AndroidRuntime(775): Caused by: android.os.NetworkOnMainThreadException
12-17 01:16:35.230: E/AndroidRuntime(775):  at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)

12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84)

12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.io.IoBridge.connectErrno(IoBridge.java:144)
12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.io.IoBridge.connect(IoBridge.java:112)

12-17 01:16:35.230: E/AndroidRuntime(775):  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)

12-17 01:16:35.230: E/AndroidRuntime(775):  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)

12-17 01:16:35.230: E/AndroidRuntime(775):  at java.net.Socket.connect(Socket.java:842)
12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.net.http.HttpConnection.<init>(HttpConnection.java:76)

12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)

12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:341)

12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)

12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)

12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315)

12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.net.http.HttpEngine.connect(HttpEngine.java:310)

12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289)

12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239)

12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)

12-17 01:16:35.230: E/AndroidRuntime(775):  at libcore.net.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:188)

12-17 01:16:35.230: E/AndroidRuntime(775):  at com.caucho.hessian.client.HessianProxy.sendRequest(HessianProxy.java:295)

12-17 01:16:35.230: E/AndroidRuntime(775):  ... 14 more

 

加载中
0
华兹格
华兹格

注意:

1.at com.caucho.hessian.client.HessianProxy.sendRequest(HessianProxy.java:297)

2.Caused by: android.os.NetworkOnMainThreadException

....

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)

....

具体原因看不出来,你需要根据源码调试。

华兹格
华兹格
回复 @冷玉 : 你试试低版本和高版本是什么情况,看看用到的方法有没有废弃,实用最新的api提供的方法。
冷玉
我的项目是android2.2的,用2.2的系统是正常的,其他系统就出这个问题!
返回顶部
顶部