AgoraIO / RTM

143 stars 160 forks source link

Android RTM 1.4.10 crash when change connection on ConnectionChangeBroadcastReceiver #176

Open Kadkad195 opened 2 years ago

Kadkad195 commented 2 years ago

Hi, Currently I updated agora rtm to 1.4.10 version. But my customer face crashes like this:

Fatal Exception: java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x4200010 (has extras) } in io.agora.rtm.internal.ConnectionChangeBroadcastReceiver@48409d at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1629) at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(-.java:2) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:257) at android.app.ActivityThread.main(ActivityThread.java:8185) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List android.net.LinkProperties.getDnsServers()' on a null object reference at io.agora.rtm.internal.Connectivity.getDnsFromConnectionManager(Connectivity.java:213) at io.agora.rtm.internal.CommonUtility.doGetNetworkInfo(CommonUtility.java:371) at io.agora.rtm.internal.CommonUtility.getNetworkInfo(CommonUtility.java:132) at io.agora.rtm.internal.CommonUtility.notifyNetworkChange(CommonUtility.java:144) at io.agora.rtm.internal.ConnectionChangeBroadcastReceiver.onReceive(ConnectionChangeBroadcastReceiver.java:22) at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1619) at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(-.java:2) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:257) at android.app.ActivityThread.main(ActivityThread.java:8185) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)

More info:

May be this happened when network is unknow, because in class ConnectionChangeBroadcastReceiver -> CommonUtility -> Connectivity -> connectivityManager.getLinkProperties(network); will return null if the network is unknown (as this document say https://developer.android.com/reference/android/net/ConnectivityManager#getLinkProperties(android.net.Network) )

Please help me some solution for this Thanks a lot!

mrkazansky commented 2 years ago

+1 faced too

plutoless commented 2 years ago

@mrkazansky @Kadkad195 i'm talking to SDK team. will update once i get response.

plutoless commented 2 years ago

@mrkazansky @Kadkad195 this is a known issue. we will fix the issue in next release 1.4.11, which will be released in early june. before that you may downgrade to 1.4.9 to workaround this issue.

Kadkad195 commented 2 years ago

Thank you so much