SignalR调用已取消

时间:2019-05-10 12:03:38

标签: java android proguard okhttp3 signalr.client

我在Android应用程序中使用signalR核心Java客户端。在启用minify之前,它工作正常,但是在启用它之后,signalR连接到服务器,但仅在第一次调用时出现了此错误:

java.util.concurrent.CancellationException: Invocation was canceled.
        at b.e.a.Y.a(InvocationRequest.java:43)
        at b.e.a.M$a.a(HubConnection.java:835)
        at b.e.a.M.f(HubConnection.java:440)
        at b.e.a.M.c(HubConnection.java:309)
        at b.e.a.n.a(lambda)
        at b.e.a.oa.b(WebSocketTransport.java:96)
        at b.e.a.oa.a(WebSocketTransport.java:56)
        at b.e.a.t.a(lambda)
        at b.e.a.ea$a.onClosing(OkHttpWebSocketWrapper.java:89)
        at okhttp3.internal.ws.RealWebSocket.onReadClose(RealWebSocket.java:345)
        at okhttp3.internal.ws.WebSocketReader.readControlFrame(WebSocketReader.java:204)
        at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:99)
        at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:262)
        at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:201)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)

我现在不是这个错误是针对signalR或okhttp的,所以我添加了但在proguard中。 这是我的监护人中的这2个。


##------------------- signalR -----------
-keep class microsoft.** { *; }
-dontwarn org.slf4j.**
##--------------- okhttp  —------—
-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
-dontnote okhttp3.**

##--------------- Okio  —------—
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

1 个答案:

答案 0 :(得分:0)

这是我的错,因为我以前使用signalR(不是核心),并且为此添加了proguard

-keep class microsoft.** { *; }

我必须为signalR内核更改它并添加

-keep class com.microsoft.** { *; }