You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SDK shouldn't crash because of ConnectivityManager on Android 11
Current Behavior
Now we have few crashes on Android 11 devices:
First one is connected with the call of AndroidNetworkListener.setupNetworkCallback
Fatal Exception: java.lang.SecurityException: Package android does not belong to 10438
at android.os.Parcel.createExceptionOrNull(Parcel.java:2376)
at android.os.Parcel.createException(Parcel.java:2360)
at android.os.Parcel.readException(Parcel.java:2343)
at android.os.Parcel.readException(Parcel.java:2285)
at android.net.IConnectivityManager$Stub$Proxy.listenForNetwork(IConnectivityManager.java:3609)
at android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:3710)
at android.net.ConnectivityManager.registerNetworkCallback(ConnectivityManager.java:4104)
at android.net.ConnectivityManager.registerNetworkCallback(ConnectivityManager.java:4074)
at com.amplitude.android.utilities.AndroidNetworkListener.setupNetworkCallback(AndroidNetworkListener.java:59)
at com.amplitude.android.utilities.AndroidNetworkListener.startListening(AndroidNetworkListener.java:32)
at com.amplitude.android.plugins.AndroidNetworkConnectivityCheckerPlugin.setup(AndroidNetworkConnectivityCheckerPlugin.kt:42)
at com.amplitude.core.platform.Timeline.add(Timeline.kt:23)
at com.amplitude.core.Amplitude.add(Amplitude.kt:465)
at com.amplitude.android.Amplitude.buildInternal$suspendImpl(Amplitude.kt:61)
at com.amplitude.android.Amplitude.buildInternal(Amplitude.kt:1)
at com.amplitude.core.Amplitude$build$built$1.invokeSuspend(Amplitude.kt:114)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Second one relates to the call of AndroidNetworkConnectivityChecker.isConnected
Fatal Exception: java.lang.SecurityException: Package android does not belong to 10511
at android.os.Parcel.createExceptionOrNull(Parcel.java:2374)
at android.os.Parcel.createException(Parcel.java:2358)
at android.os.Parcel.readException(Parcel.java:2341)
at android.os.Parcel.readException(Parcel.java:2283)
at android.net.IConnectivityManager$Stub$Proxy.getNetworkCapabilities(IConnectivityManager.java:2456)
at android.net.ConnectivityManager.getNetworkCapabilities(ConnectivityManager.java:1386)
at com.amplitude.android.utilities.AndroidNetworkConnectivityChecker.isConnected(AndroidNetworkConnectivityChecker.java:42)
at com.amplitude.android.plugins.AndroidNetworkConnectivityCheckerPlugin$setup$1.invokeSuspend(AndroidNetworkConnectivityCheckerPlugin.kt:25)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Expected Behavior
SDK shouldn't crash because of ConnectivityManager on Android 11
Current Behavior
Now we have few crashes on Android 11 devices:
AndroidNetworkListener.setupNetworkCallback
AndroidNetworkConnectivityChecker.isConnected
Possible Solution
Actually it's a known issue on Android 11: https://issuetracker.google.com/issues/175055271
So the only possible workaround is just adding try-catch block with possible checking build version
Steps to Reproduce
Environment
The text was updated successfully, but these errors were encountered: