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

I have a report on this exception, although I have 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> 
+6
source share
2 answers

Try to restore your project (clean, build). If this does not help, you can try this slightly strange solution from here , which seems to work.

+4
source

Remove minSdk and targetSdk from the manifest file and add it to gradle.app as shown 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 } 
0
source

Source: https://habr.com/ru/post/980434/


All Articles