0

I'm getting this exception even if I have ACCESS_NETWORK_STATE permission granted.

 Caused by: java.lang.SecurityException:
at android.os.Parcel.createExceptionOrNull (Parcel.java:2385)
at android.os.Parcel.createException (Parcel.java:2369)
at android.os.Parcel.readException (Parcel.java:2352)
at android.os.Parcel.readException (Parcel.java:2294)
at android.net.IConnectivityManager$Stub$Proxy.getNetworkCapabilities (IConnectivityManager.java:3347)
at android.net.ConnectivityManager.getNetworkCapabilities (ConnectivityManager.java:1549)

How to avoid it?

Raluca
  • 41
  • 5
  • 1
    Does this answer your question? [Getting Security exception while trying to fetch networkcapabilities on android 11](https://stackoverflow.com/questions/66652819/getting-security-exception-while-trying-to-fetch-networkcapabilities-on-android) – zack Jul 26 '21 at 16:04

1 Answers1

1

It's a known issue: https://issuetracker.google.com/issues/175055271?pli=1

You could wrap the call in a try/catch to handle the exception, and at least avoid the crash.

zack
  • 3,198
  • 2
  • 35
  • 51