User does not have android.permission.ACCESS_NETWORK_STATE

My application crashes on startup with this error. I have permissions in my manifest, so I'm not sure what's going on.

    --------- beginning of crash
06-14 09:50:31.638 2550-2550/com.rebeccafuller.movienight E/AndroidRuntime: FATAL EXCEPTION: main
                                                                            Process: com.rebeccafuller.movienight, PID: 2550
                                                                            java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rebeccafuller.movienight/com.rebeccafuller.movienight.ui.MainActivity}: java.lang.SecurityException: ConnectivityService: Neither user 10074 nor current process has android.permission.ACCESS_NETWORK_STATE.

      

Here is my android manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.rebeccafuller.movienight">

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".ui.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

      

+3


source to share


1 answer


remove permissions and try cleaning and building. This will crash again .. then add those 3 permissions again and execute.

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

      



it will solve your problem

0


source







All Articles