在我的Android应用中使用OkHTTP,我有很多例外: EX:
java.lang.AssertionError: libcore.io.ErrnoException: getsockname failed: EBADF (Bad file number)
at libcore.io.IoBridge.getSocketLocalPort(IoBridge.java:649)
at libcore.io.IoBridge.closeSocket(IoBridge.java:202)
at java.net.PlainSocketImpl.close(PlainSocketImpl.java:162)
at ...
Caused by: libcore.io.ErrnoException: getsockname failed: EBADF (Bad file number)
at libcore.io.Posix.getsockname(Posix.java)
at libcore.io.ForwardingOs.getsockname(ForwardingOs.java:69)
at libcore.io.IoBridge.getSocketLocalPort(IoBridge.java:645)
at libcore.io.IoBridge.closeSocket(IoBridge.java:202)
at java.net.PlainSocketImpl.close(PlainSocketImpl.java:162)
at java.net.Socket.close(Socket.java:319)
at ...
我无法捕获此错误,因为它位于OkHTTP库中。
对我来说有什么解决方案吗?
由于
答案 0 :(得分:0)
我终于与OkHttp团队讨论了,现在修复程序已经在当前版本中了!
OkHttp v2.5.0
OkIO v1.6.0
更多信息: https://github.com/square/okhttp/pull/1817
根本原因是android 4错误: https://code.google.com/p/android/issues/detail?id=54072