B.Houcem
B.Houcem

Reputation: 113

Android ConnectivityService "Neither user 10052 nor current process has android.permission.ACCESS_NETWORK_STATE."

I have a report of this exception even though I have the permission in the manifest:

E/AndroidRuntime(1215): java.lang.RuntimeException: Unable to start activity ComponentInfo{****}: java.lang.SecurityException: ConnectivityService: Neither user 10052 nor current process has android.permission.ACCESS_NETWORK_STATE.

Manifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="****"
    android:versionCode="1"
    android:versionName="1.0" >

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

     <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="21" />

<application>
    ....
    </application>

</manifest>

Upvotes: 11

Views: 29063

Answers (2)

Deeptimay Routray
Deeptimay Routray

Reputation: 166

Remove minSdk and targetSdk from manifest file and add it to the gradle.app, like below.

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    defaultConfig {
    applicationId "com.demo.demo.activity"

    minSdkVersion 16
    targetSdkVersion 22
    versionCode 37
    versionName "4.1.8"

    multiDexEnabled true
}

Upvotes: 0

Bartek Lipinski
Bartek Lipinski

Reputation: 31458

Try rebuilding your project (clean, build). If it doesn't help, you can try this a bit weird solution from here that seems to be working.

Upvotes: 7

Related Questions