socket.io-client-java icon indicating copy to clipboard operation
socket.io-client-java copied to clipboard

[Crash] I have a crash in EventThread when using R8

Open kimdew0912 opened this issue 4 years ago • 1 comments

Hi! Our product is using your socket io library and we are really satisfied with the library.

But, I faced a crash in EventThread below when using R8.

09-30 16:27:57.634 E/AndroidRuntime(14071): java.lang.NullPointerException
09-30 16:27:57.634 E/AndroidRuntime(14071): 	at java.util.Objects.requireNonNull(Objects.java:203)
09-30 16:27:57.634 E/AndroidRuntime(14071): 	at io.socket.thread.EventThread$2.run(chromium-WhalePublic.apk-default-1144:9)
09-30 16:27:57.634 E/AndroidRuntime(14071): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
09-30 16:27:57.634 E/AndroidRuntime(14071): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
09-30 16:27:57.634 E/AndroidRuntime(14071): 	at java.lang.Thread.run(Thread.java:919)

I'm using the engine and client version 1.0.0 and I faced this crash after my app applied R8. It seems that the crash occurred after connecting socket or when handling some Runnable in EventThread.

So, I'm trying to solve it in several ways, but I couldn't fix the issue. Even though I added some rules like this -keep class io.socket.** { *; } to my proguard file, still faced the same issue.

I know this issue can be caused by our build environment possibly, but I haven't been resolving it as mentioned. Could you help me about the crash by any chance?

kimdew0912 avatar Sep 30 '21 10:09 kimdew0912

I resolved this issue.

The reason of the NPE is that java.util.logging.Logger was discarded in R8. So I resolved this issue by removing the discard logic in our proguard rule file.

But you need to check every logic related to Logger because some logics are missing the if (Logger.isLoggable(Level.FINE)).

(If you admin, please close this issue.)

kimdew0912 avatar Oct 01 '21 08:10 kimdew0912