Open suriyansuresh opened 5 years ago
Hi to all. Yesterday i've faced out with this issue when wanna to send some data to server with the help of _socket.sendMessage(). I've spent a lot of time to figure out and find some solution, but without any success.
Here are my steps to reproduce:
And as result - application crash with exception mentioned above.
It's still an issue in version 0.5.0
I have faced the same issue. Working fine in: ^0.5.1
Flutter doctor output Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel beta, v1.6.3, on Microsoft Windows [Version 10.0.17134.765], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [√] Android Studio (version 3.2) [√] IntelliJ IDEA Community Edition (version 2018.1) [√] VS Code, 64-bit edition (version 1.35.0) [√] Connected device (1 available)
• No issues found!
Error Message
Launching lib\main.dart on Android SDK built for x86 in debug mode... Built build\app\outputs\apk\debug\app-debug.apk. I/flutter (11658): ===== Loaded dev local ===== I/flutter (11658): =====API Server => http://10.0.2.2:3000/v1===== I/flutter (11658): =====WS Server => http://10.0.2.2:3000===== I/flutter (11658): =====gAppID Server => zrqc1KhfpXn8cf7_Gx3dfG===== D/EGL_emulation(11658): eglMakeCurrent: 0xe2085300: ver 2 0 (tinfo 0xe2083400) I/flutter (11658): CREATING NEW SOCKET: http://10.0.2.2:3000/ D/FlutterSocketIoPlugin: FlutterSocketIoPlugin(11658): onMethodCall: socketInit - domain: http://10.0.2.2:3000 - with namespace: / D/FlutterSocketIoPlugin: TOTAL SOCKETS: (11658): 0 D/FlutterSocketIoPlugin: TOTAL SOCKETS: (11658): 0 D/FlutterSocketIoPlugin: added SocketIO(11658): http://10.0.2.2:3000/ D/FlutterSocketIoPlugin: SocketIO(11658): query: userId=21031 D/FlutterSocketIoPlugin: SocketIO(11658): connecting...null I/flutter (11658): Connection Listeners has been added D/FlutterSocketIoPlugin: FlutterSocketIoPlugin(11658): onMethodCall: socketConnect - domain: http://10.0.2.2:3000 - with namespace: / D/FlutterSocketIoPlugin: TOTAL SOCKETS: (11658): 1 D/FlutterSocketIoPlugin: SocketIO(11658): connecting socket: http://10.0.2.2:3000/ D/NetworkSecurityConfig(11658): No Network Security Config specified, using platform default E/EventThread(11658): Task threw exception E/EventThread(11658): java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: EventThread E/EventThread(11658): at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:605) E/EventThread(11658): at io.flutter.embedding.engine.FlutterJNI.dispatchPlatformMessage(FlutterJNI.java:515) E/EventThread(11658): at io.flutter.embedding.engine.dart.DartMessenger.send(DartMessenger.java:76) E/EventThread(11658): at io.flutter.embedding.engine.dart.DartExecutor.send(DartExecutor.java:166) E/EventThread(11658): at io.flutter.view.FlutterNativeView.send(FlutterNativeView.java:155) E/EventThread(11658): at io.flutter.plugin.common.MethodChannel.invokeMethod(MethodChannel.java:98) E/EventThread(11658): at io.flutter.plugin.common.MethodChannel.invokeMethod(MethodChannel.java:84) E/EventThread(11658): at com.itsclicking.clickapp.fluttersocketio.SocketIO.onSocketCallback(SocketIO.java:121) E/EventThread(11658): at com.itsclicking.clickapp.fluttersocketio.SocketIO.access$000(SocketIO.java:28) E/EventThread(11658): at com.itsclicking.clickapp.fluttersocketio.SocketIO$9.call(SocketIO.java:144) E/EventThread(11658): at io.socket.emitter.Emitter.emit(Emitter.java:117) E/EventThread(11658): at io.socket.client.Socket.access$601(Socket.java:24) E/EventThread(11658): at io.socket.client.Socket$5.run(Socket.java:186) E/EventThread(11658): at io.socket.thread.EventThread.exec(EventThread.java:55) E/EventThread(11658): at io.socket.client.Socket.emit(Socket.java:182) E/EventThread(11658): at io.socket.client.Socket.onconnect(Socket.java:389) E/EventThread(11658): at io.socket.client.Socket.onpacket(Socket.java:283) E/EventThread(11658): at io.socket.client.Socket.access$100(Socket.java:24) E/EventThread(11658): at io.socket.client.Socket$2$2.call(Socket.java:120) E/EventThread(11658): at io.socket.emitter.Emitter.emit(Emitter.java:117) E/EventThread(11658): at io.socket.client.Manager.ondecoded(Manager.java:427) E/EventThread(11658): at io.socket.client.Manager.access$1600(Manager.java:30) E/EventThread(11658): at io.socket.client.Manager$7.call(Manager.java:403) E/EventThread(11658): at io.socket.parser.IOParser$Decoder.add(IOParser.java:105) E/EventThread(11658): at io.socket.client.Manager.ondata(Manager.java:419) E/EventThread(11658): at io.socket.client.Manager.access$1000(Manager.java:30) E/EventThread(11658): at io.socket.client.Manager$2.call(Manager.java:370) E/EventThread(11658): at io.socket.emitter.Emitter.emit(Emitter.java:117) E/EventThread(11658): at io.socket.engineio.client.Socket.onPacket(Socket.java:551) E/EventThread(11658): at io.socket.engineio.client.Socket.access$1000(Socket.java:36) E/EventThread(11658): at io.socket.engineio.client.Socket$5.call(Socket.java:335) E/EventThread(11658): at io.socket.emitter.Emitter.emit(Emitter.java:117) E/EventThread(11658): at io.socket.engineio.client.Transport.onPacket(Transport.java:126) E/EventThread(11658): at io.socket.engineio.client.Transport.onData(Transport.java:118) E/EventThread(11658): at io.socket.engineio.client.transports.WebSocket.access$100(WebSocket.java:24) E/EventThread(11658): at io.socket.engineio.client.transports.WebSocket$1$2.run(WebSocket.java:71) E/EventThread(11658): at io.socket.thread.EventThread$2.run(EventThread.java:80) E/EventThread(11658): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) E/EventThread(11658): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) E/EventThread(11658): at java.lang.Thread.run(Thread.java:764) E/AndroidRuntime(11658): FATAL EXCEPTION: EventThread E/AndroidRuntime(11658): Process: com.example.tooj, PID: 11658 E/AndroidRuntime(11658): java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: EventThread E/AndroidRuntime(11658): at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:605) E/AndroidRuntime(11658): at io.flutter.embedding.engine.FlutterJNI.dispatchPlatformMessage(FlutterJNI.java:515) E/AndroidRuntime(11658): at io.flutter.embedding.engine.dart.DartMessenger.send(DartMessenger.java:76) E/AndroidRuntime(11658): at io.flutter.embedding.engine.dart.DartExecutor.send(DartExecutor.java:166) E/AndroidRuntime(11658): at io.flutter.view.FlutterNativeView.send(FlutterNativeView.java:155) E/AndroidRuntime(11658): at io.flutter.plugin.common.MethodChannel.invokeMethod(MethodChannel.java:98) E/AndroidRuntime(11658): at io.flutter.plugin.common.MethodChannel.invokeMethod(MethodChannel.java:84) E/AndroidRuntime(11658): at com.itsclicking.clickapp.fluttersocketio.SocketIO.onSocketCallback(SocketIO.java:121) E/AndroidRuntime(11658): at com.itsclicking.clickapp.fluttersocketio.SocketIO.access$000(SocketIO.java:28) E/AndroidRuntime(11658): at com.itsclicking.clickapp.fluttersocketio.SocketIO$9.call(SocketIO.java:144) E/AndroidRuntime(11658): at io.socket.emitter.Emitter.emit(Emitter.java:117) E/AndroidRuntime(11658): at io.socket.client.Socket.access$601(Socket.java:24) E/AndroidRuntime(11658): at io.socket.client.Socket$5.run(Socket.java:186) E/AndroidRuntime(11658): at io.socket.thread.EventThread.exec(EventThread.java:55) E/AndroidRuntime(11658): at io.socket.client.Socket.emit(Socket.java:182) E/AndroidRuntime(11658): at io.socket.client.Socket.onconnect(Socket.java:389) E/AndroidRuntime(11658): at io.socket.client.Socket.onpacket(Socket.java:283) E/AndroidRuntime(11658): at io.socket.client.Socket.access$100(Socket.java:24) E/AndroidRuntime(11658): at io.socket.client.Socket$2$2.call(Socket.java:120) E/AndroidRuntime(11658): at io.socket.emitter.Emitter.emit(Emitter.java:117) E/AndroidRuntime(11658): at io.socket.client.Manager.ondecoded(Manager.java:427) E/AndroidRuntime(11658): at io.socket.client.Manager.access$1600(Manager.java:30) E/AndroidRuntime(11658): at io.socket.client.Manager$7.call(Manager.java:403) E/AndroidRuntime(11658): at io.socket.parser.IOParser$Decoder.add(IOParser.java:105) E/AndroidRuntime(11658): at io.socket.client.Manager.ondata(Manager.java:419) E/AndroidRuntime(11658): at io.socket.client.Manager.access$1000(Manager.java:30) E/AndroidRuntime(11658): at io.socket.client.Manager$2.call(Manager.java:370) E/AndroidRuntime(11658): at io.socket.emitter.Emitter.emit(Emitter.java:117) E/AndroidRuntime(11658): at io.socket.engineio.client.Socket.onPacket(Socket.java:551) E/AndroidRuntime(11658): at io.socket.engineio.client.Socket.access$1000(Socket.java:36) E/AndroidRuntime(11658): at io.socket.engineio.client.Socket$5.call(Socket.java:335) E/AndroidRuntime(11658): at io.socket.emitter.Emitter.emit(Emitter.java:117) E/AndroidRuntime(11658): at io.socket.engineio.client.Transport.onPacket(Transport.java:126) E/AndroidRuntime(11658): at io.socket.engineio.client.Transport.onData(Transport.java:118) E/AndroidRuntime(11658): at io.socket.engineio.client.transports.WebSocket.access$100(WebSocket.java:24) E/AndroidRuntime(11658): at io.socket.engineio.client.transports.WebSocket$1$2.run(WebSocket.java:71) E/AndroidRuntime(11658): at io.socket.thread.EventThread$2.run(EventThread.java:80) E/AndroidRuntime(11658): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) E/AndroidRuntime(11658): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) E/AndroidRuntime(11658): at java.lang.Thread.run(Thread.java:764) D/EGL_emulation(11658): eglMakeCurrent: 0xe9f65e20: ver 2 0 (tinfo 0xcb6f4b80) W/zygote (11658): Suspending all threads took: 5.645ms Lost connection to device. Exited (sigterm)