java.lang.SecurityException: ConnectivityService: Neither user 10134 nor current process has android.permission.ACCESS_NETWORK_STATE

android

Solution

I had this problem as well... when building against an earlier API, I was simply getting an `unhandledException` thrown, which I noticed when stepping over the `getAllNetworkInfo()` or `getActiveNetworkInfo()`. However, nothing was actually shown in logcat. When building against the newest API (22), I got the above-mentioned `SecurityException`.

For me, the solution turned out to be that I had written

<uses-permission android:name="ANDROID.PERMISSION.INTERNET" />
<uses-permission android:name="ANDROID.PERMISSION.ACCESS_NETWORK_STATE" />

when instead I needed

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

So, to any developer experiencing this issue and scratching his head, please note that these permission names are case sensitive!

Problem

I got a report of this exception from 1 user even though I have the permission in the manifest ``` <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> ```

Original source