默认
发表评论 5
想开发IM:买成品怕坑?租第3方怕贵?找开源自已撸?尽量别走弯路了... 找站长给点建议
求助我的IM切换到4G网络时耗时几分钟才登录成功
阅读(37182) | 评论(5 收藏 淘帖
代码改来改去,突然发现客户端切到4G网络时(无线网情况快速正常),需要很长时间才能登录成功。回溯版本已经不可能了,请教一下我应该从哪里下手?大概哪些地方?

即时通讯网 - 即时通讯开发者社区! 来源: - 即时通讯开发者社区!

标签:IM开发
上一篇:仅使用移动端IM框架,服务器 最低配置需求是多少下一篇:即时通讯安全篇(七):用JWT技术解决IM系统Socket长连接的身份认证痛点
推荐方案
评论 5

首先,你给的日志完成看不出来你所描述的现象的过程,你抓Log也好歹也上点心,随便抓抓神也猜不出来啊。

另外,你的log里有一个异常,你没有注意到?
11-21 22:13:29.392 16878-16878/com.future.social W/System.err: android.os.NetworkOnMainThreadException
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1147)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at java.net.InetAddress.lookupHostByName(InetAddress.java:418)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at java.net.InetAddress.getByName(InetAddress.java:305)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at com.alibaba.sdk.android.oss.common.utils.OSSUtils.isValidateIP(OSSUtils.java:781)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at com.alibaba.sdk.android.oss.OSSImpl.<init>(OSSImpl.java:117)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at com.alibaba.sdk.android.oss.OSSClient.<init>(OSSClient.java:100)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at com.future.social.fragment_acivity.MyMessageActivity._initListView(MyMessageActivity.java:164)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at com.future.social.fragment_acivity.MyMessageActivity.onStart(MyMessageActivity.java:509)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1245)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.app.Activity.performStart(Activity.java:6099)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2367)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.app.ActivityThread.startActivityNow(ActivityThread.java:2228)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:136)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:348)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:757)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.widget.TabHost.setCurrentTab(TabHost.java:421)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.widget.TabHost.addTab(TabHost.java:247)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at com.future.social.MainActivity.initUI(MainActivity.java:362)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at com.future.social.MainActivity.onCreate(MainActivity.java:174)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.app.Activity.performCreate(Activity.java:6083)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1115)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2357)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2466)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.app.ActivityThread.access$900(ActivityThread.java:175)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1369)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.os.Looper.loop(Looper.java:135)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5418)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at java.lang.reflect.Method.invoke(Method.java:372)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1037)
11-21 22:13:29.392 16878-16878/com.future.social W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
Android log

android_log.rar

14.24 KB, 下载次数: 3

android日志

引用:承泽 发表于 2018-11-21 21:58
底层MobileIMSDK没有修改

你回忆一下:最近修改了哪些代码,然后可以把你认为有嫌疑的代码贴出来。

另外,客户端的log很关键:你可以把客户端log在Android Studio下清空一下后,当把网切到4G后直至登陆成功这段时间的所有log全抓出来,贴到本贴,一起分析分析。

注意:log里只要显示本APP的log,系统的其它Log就把它过滤掉,别弄个上午行log,有用的几有几行。。。
底层MobileIMSDK没有修改
你的意思是,你对MobileIMSDK代码做过修改后,当客户端从WiFi切换到4G后,程序需要几分钟才能登陆成功?
打赏楼主 ×
使用微信打赏! 使用支付宝打赏!

返回顶部