Flutter:无法通过 quickblox 发送消息
Flutter: Unable to send message via quickblox
这个问题属于用过quickblox sdk的人。
我将通过 quickBlox sdk 创建一个聊天应用程序。我从 pub.dev 安装了软件包,它可以很好地创建用户、登录和创建对话框,但是当我调用发送方法时,我遇到了这个错误,任何人都可以帮助我。
[ +22 ms] E/MethodChannel#FlutterQBChatChannel(20162): Failed to handle method call
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): at com.quickblox.quickblox_sdk.chat.ChatModule.sendMessage(ChatModule.java:681)
[ +12 ms] E/MethodChannel#FlutterQBChatChannel(20162): at com.quickblox.quickblox_sdk.chat.ChatModule.handleMethod(ChatModule.java:148)
[ +9 ms] E/MethodChannel#FlutterQBChatChannel(20162): at
com.quickblox.quickblox_sdk.chat.-$$Lambda$DVgH6HdFVfXJ1jon6MQo8bSJBRA.onMethodCall(Unknown Source:2)
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): at
io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
[ ] E/MethodChannel#FlutterQBChatChannel(20162): at
io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): at
io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart[=10=]$DartMessenger(DartMessenger.java:206)
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): at
io.flutter.embedding.engine.dart.-$$Lambda$DartMessengerZD1MYkhaLxyPjtoFDxe45u43DI.run(Unknown Source:12)
[ ] E/MethodChannel#FlutterQBChatChannel(20162): at android.os.Handler.handleCallback(Handler.java:873)
[ ] E/MethodChannel#FlutterQBChatChannel(20162): at android.os.Handler.dispatchMessage(Handler.java:99)
[ ] E/MethodChannel#FlutterQBChatChannel(20162): at android.os.Looper.loop(Looper.java:193)
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): at android.app.ActivityThread.main(ActivityThread.java:6669)
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): at java.lang.reflect.Method.invoke(Native Method)
[ +3 ms] E/MethodChannel#FlutterQBChatChannel(20162): at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
[ +37 ms] E/MethodChannel#FlutterQBChatChannel(20162): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
[ +24 ms] I/flutter (20162): java.lang.String cannot be cast to java.lang.Long//null//java.lang.ClassCastException: java.lang.String
cannot be cast to java.lang.Long
[ +2 ms] I/flutter (20162): at com.quickblox.quickblox_sdk.chat.ChatModule.sendMessage(ChatModule.java:681)
[ +1 ms] I/flutter (20162): at com.quickblox.quickblox_sdk.chat.ChatModule.handleMethod(ChatModule.java:148)
[ +2 ms] I/flutter (20162): at com.quickblox.quickblox_sdk.chat.-$$Lambda$DVgH6HdFVfXJ1jon6MQo8bSJBRA.onMethodCall(Unknown Source:2)
[ +1 ms] I/flutter (20162): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
[ +1 ms] I/flutter (20162): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
[ +1 ms] I/flutter (20162): at
io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart[=10=]$DartMessenger(DartMessenger.java:206)
[ +1 ms] I/flutter (20162): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessengerZD1MYkhaLxyPjtoFDxe45u43DI.run(Unknown
Source:12)
[ ] I/flutter (20162): at android.os.Handler.handleCallback(Handler.java:873)
[ +1 ms] I/flutter (20162): at android.os.Handler.dispatchMessage(Handler.java:99)
[ ] I/flutter (20162): at android.os.Looper.loop(Looper.java:193)
[ ] I/flutter (20162): at android.app.ActivityThread.main(A
由于 dateSent 参数,出现此异常。我遇到了同样的问题,我能够通过发送 null 作为值来解决它,因为不需要 dateSent。
这个问题属于用过quickblox sdk的人。
我将通过 quickBlox sdk 创建一个聊天应用程序。我从 pub.dev 安装了软件包,它可以很好地创建用户、登录和创建对话框,但是当我调用发送方法时,我遇到了这个错误,任何人都可以帮助我。
[ +22 ms] E/MethodChannel#FlutterQBChatChannel(20162): Failed to handle method call
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): at com.quickblox.quickblox_sdk.chat.ChatModule.sendMessage(ChatModule.java:681)
[ +12 ms] E/MethodChannel#FlutterQBChatChannel(20162): at com.quickblox.quickblox_sdk.chat.ChatModule.handleMethod(ChatModule.java:148)
[ +9 ms] E/MethodChannel#FlutterQBChatChannel(20162): at
com.quickblox.quickblox_sdk.chat.-$$Lambda$DVgH6HdFVfXJ1jon6MQo8bSJBRA.onMethodCall(Unknown Source:2)
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): at
io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
[ ] E/MethodChannel#FlutterQBChatChannel(20162): at
io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): at
io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart[=10=]$DartMessenger(DartMessenger.java:206)
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): at
io.flutter.embedding.engine.dart.-$$Lambda$DartMessengerZD1MYkhaLxyPjtoFDxe45u43DI.run(Unknown Source:12)
[ ] E/MethodChannel#FlutterQBChatChannel(20162): at android.os.Handler.handleCallback(Handler.java:873)
[ ] E/MethodChannel#FlutterQBChatChannel(20162): at android.os.Handler.dispatchMessage(Handler.java:99)
[ ] E/MethodChannel#FlutterQBChatChannel(20162): at android.os.Looper.loop(Looper.java:193)
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): at android.app.ActivityThread.main(ActivityThread.java:6669)
[ +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): at java.lang.reflect.Method.invoke(Native Method)
[ +3 ms] E/MethodChannel#FlutterQBChatChannel(20162): at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
[ +37 ms] E/MethodChannel#FlutterQBChatChannel(20162): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
[ +24 ms] I/flutter (20162): java.lang.String cannot be cast to java.lang.Long//null//java.lang.ClassCastException: java.lang.String
cannot be cast to java.lang.Long
[ +2 ms] I/flutter (20162): at com.quickblox.quickblox_sdk.chat.ChatModule.sendMessage(ChatModule.java:681)
[ +1 ms] I/flutter (20162): at com.quickblox.quickblox_sdk.chat.ChatModule.handleMethod(ChatModule.java:148)
[ +2 ms] I/flutter (20162): at com.quickblox.quickblox_sdk.chat.-$$Lambda$DVgH6HdFVfXJ1jon6MQo8bSJBRA.onMethodCall(Unknown Source:2)
[ +1 ms] I/flutter (20162): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
[ +1 ms] I/flutter (20162): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
[ +1 ms] I/flutter (20162): at
io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart[=10=]$DartMessenger(DartMessenger.java:206)
[ +1 ms] I/flutter (20162): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessengerZD1MYkhaLxyPjtoFDxe45u43DI.run(Unknown
Source:12)
[ ] I/flutter (20162): at android.os.Handler.handleCallback(Handler.java:873)
[ +1 ms] I/flutter (20162): at android.os.Handler.dispatchMessage(Handler.java:99)
[ ] I/flutter (20162): at android.os.Looper.loop(Looper.java:193)
[ ] I/flutter (20162): at android.app.ActivityThread.main(A
由于 dateSent 参数,出现此异常。我遇到了同样的问题,我能够通过发送 null 作为值来解决它,因为不需要 dateSent。