Okhttp 3和Socket.io冲突

时间:2016-08-24 18:03:14

标签: android node.js socket.io okhttp3

我有一个使用OkHttp3Socket.io连接到node.js服务器的应用

io.socket:socket.io-client:0.7.0
com.squareup.okhttp3:okhttp:3.4.1

在OkHttp客户端的一些请求之后我尝试连接套接字然后它抛出了这个错误:

FATAL EXCEPTION: EventThread
 Process: dge.cetic.panicbutton, PID: 18346
 java.lang.NoSuchMethodError: okhttp3.internal.Internal.callEnqueue
     at okhttp3.ws.WebSocketCall.enqueue(WebSocketCall.java:108)
     at io.socket.engineio.client.transports.WebSocket.doOpen(WebSocket.java:73)
     at io.socket.engineio.client.Transport$1.run(Transport.java:75)
     at io.socket.thread.EventThread.exec(EventThread.java:50)
     at io.socket.engineio.client.Transport.open(Transport.java:70)
     at io.socket.engineio.client.Socket.probe(Socket.java:458)
     at io.socket.engineio.client.Socket.onOpen(Socket.java:471)
     at io.socket.engineio.client.Socket.onHandshake(Socket.java:512)
     at io.socket.engineio.client.Socket.onPacket(Socket.java:485)
     at io.socket.engineio.client.Socket.access$900(Socket.java:30)
     at io.socket.engineio.client.Socket$5.call(Socket.java:299)
     at io.socket.emitter.Emitter.emit(Emitter.java:117)
     at io.socket.engineio.client.Transport.onPacket(Transport.java:127)
     at io.socket.engineio.client.transports.Polling.access$700(Polling.java:17)
     at io.socket.engineio.client.transports.Polling$2.call(Polling.java:124)
     at io.socket.engineio.parser.Parser.decodePayload(Parser.java:251)
     at io.socket.engineio.client.transports.Polling._onData(Polling.java:134)
     at io.socket.engineio.client.transports.Polling.onData(Polling.java:106)
     at io.socket.engineio.client.transports.PollingXHR$5$1.run(PollingXHR.java:113)
     at io.socket.thread.EventThread$2.run(EventThread.java:75)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
     at java.lang.Thread.run(Thread.java:841)

只有当两个库一起使用并且一个接一个地使用时,才会抛出此错误 因为它显示了一个线程异常,我试过:

  1. OkHttp客户端中的enqueue()
  2. 在线程上运行套接字连接的处理程序
  3. 但错误仍然相同。 这可能是其中一个库中的一个问题吗?

0 个答案:

没有答案