TencentCloud / TIMSDK

Tencent Cloud Chat features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication.
https://trtc.io/products/chat
2.59k stars 2.76k forks source link

【Android】-【4.5.45】:打开群聊会话闪退 #496

Closed 2314372037 closed 4 years ago

2314372037 commented 5 years ago

【当前现象】:进入聊天界面立即崩溃,或者10s+后闪退 【集成包】:TUIKIT 【机型】:诺基亚7(绝不止这款机型) 【之前版本有无此问题】:未知 【日志】: 崩溃发生在ChatManagerKit 崩溃之前logcat会发现各种imsdk的解析json错误日志(parse json error)

2019-11-08 16:41:51.476 25012-25085/com.example.xxxx E/imsdk: TIM: 2019-11-08 16:41:51.476/E/25012-25012 /IMSDK -TUIKit-MessageInfoUtil.0: /parse json error 2019-11-08 16:41:51.480 25012-25085/com.example.xxxx E/imsdk: TIM: 2019-11-08 16:41:51.480/E/25012-25012 /IMSDK -TUIKit-MessageInfoUtil.0: /parse json error 2019-11-08 16:41:51.483 25012-25085/com.example.xxxx E/imsdk: TIM: 2019-11-08 16:41:51.483/E/25012-25012 /IMSDK -TUIKit-MessageInfoUtil.0: /parse json error 2019-11-08 16:41:51.487 25012-25085/com.example.xxxx E/imsdk: TIM: 2019-11-08 16:41:51.486/E/25012-25012 /IMSDK -TUIKit-MessageInfoUtil.0: /parse json error 2019-11-08 16:41:51.491 25012-25085/com.example.xxxx E/imsdk: TIM: 2019-11-08 16:41:51.489/E/25012-25012 /IMSDK -TUIKit-MessageInfoUtil.0: /parse json error 2019-11-08 16:41:51.511 25012-25012/com.example.xxxx D/AndroidRuntime: Shutting down VM 2019-11-08 16:41:51.513 25012-25012/com.example.xxxx E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.xxxx , PID: 25012 java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.tencent.qcloud.tim.uikit.modules.chat.base.ChatProvider.addMessageList(java.util.List, boolean)' on a null object reference at com.tencent.qcloud.tim.uikit.modules.chat.base.ChatManagerKit$5.onSuccess(ChatManagerKit.java:405) at com.tencent.qcloud.tim.uikit.modules.chat.base.ChatManagerKit$5.onSuccess(ChatManagerKit.java:374) at com.tencent.imsdk.conversation.Conversation$6$2.run(Conversation.java:387) at android.os.Handler.handleCallback(Handler.java:874) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:198) at android.app.ActivityThread.main(ActivityThread.java:6729) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

2314372037 commented 5 years ago

补充: 1.群人数接近2000 2.最近打开聊天界面加载特别慢(20s+) 3.大概率重现方式:打开app->进群聊->在加载的时候(特别慢)->返回退出聊天界面回到app主页->坐等崩溃 4.2019-11-08 16:52:34.494 26850-26917/com.example.xxxx I/imsdk: TIM: 2019-11-08 16:52:34.494/I/26850-26923 /Msg -imcore_message_util.cpp.181:CheckDup /size: 500, remove count: 100 2019-11-08 16:52:34.512 26850-26917/com.example.xxxx I/imsdk: TIM: 2019-11-08 16:52:34.512/I/26850-26923 /Msg -imcore_message_util.cpp.181:CheckDup /size: 500, remove count: 100 2019-11-08 16:52:34.530 26850-26917/com.example.xxxx I/imsdk: TIM: 2019-11-08 16:52:34.530/I/26850-26923 /Msg -imcore_message_util.cpp.181:CheckDup /size: 500, remove count: 100 2019-11-08 16:52:34.555 26850-26850/com.example.xxxx D/AndroidRuntime: Shutting down VM

--------- beginning of crash

2019-11-08 16:52:34.556 26850-26850/com.example.xxxx E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.xxxx , PID: 26850 java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.tencent.qcloud.tim.uikit.modules.chat.base.ChatProvider.addMessageList(java.util.List, boolean)' on a null object reference at com.tencent.qcloud.tim.uikit.modules.chat.base.ChatManagerKit$5.onSuccess(ChatManagerKit.java:405) at com.tencent.qcloud.tim.uikit.modules.chat.base.ChatManagerKit$5.onSuccess(ChatManagerKit.java:374) at com.tencent.imsdk.conversation.Conversation$6$2.run(Conversation.java:387) at android.os.Handler.handleCallback(Handler.java:874) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:198) at android.app.ActivityThread.main(ActivityThread.java:6729) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

2314372037 commented 5 years ago

找到原因了,在ChatManagerKit的两个onSucess加上 if (!safetyCall()) { TUIKitLog.w(TAG, "unSafetyCall"); return; } 就行了,退出会话界面mCurrentConversation和mCurrentProvider都为空,做个判断就行了