icerockdev / moko-socket-io

MOKO SocketIo by IceRock is Socket.IO implementation Kotlin Multiplatform library
https://moko.icerock.dev/
Apache License 2.0
123 stars 23 forks source link

Exception NoSuchFieldException on Android 9 #4

Closed Tetraquark closed 3 years ago

Tetraquark commented 3 years ago

After creating an object of the Socket class, each time I get NoSuchFieldException with stacktrace on an Android 9 device:

W/System.err: java.lang.NoSuchFieldException: No field streamHandlers in class Ljava/net/URL; (declaration of 'java.net.URL' appears in /apex/com.android.runtime/javalib/core-oj.jar)
        at java.lang.Class.getDeclaredField(Native Method)
        at dev.icerock.moko.socket.Socket.addURLProtocols(Socket.kt:95)
        at dev.icerock.moko.socket.Socket.<init>(Socket.kt:29)
        at com.snow4unet.snowtinder.chatdomain.di.SocketFactory.createSocket(SocketFactory.kt:17)
        at com.snow4unet.snowtinder.chatdomain.repository.SocketRepository.getSocket(SocketRepository.kt:24)
TomWayne98 commented 3 years ago

I have the same problem. Any update on this?

Tetraquark commented 3 years ago

Unfortunately, there are no updates yet

ciprig commented 3 years ago

That's cause by addURLProtocols() method, not sure why is needed? also running from jvm integration test fail because of that

Alex009 commented 3 years ago

we remove this method at all