. lang NetworkDispatcher.run:未处理的异常。SecurityException:权限被拒绝(丢失INTERNET权限?)

时间:2022-10-11 23:04:48

I am getting the following error:

我得到以下错误:

NetworkDispatcher.run: Unhandled exception java.lang.SecurityException: Permission denied (missing INTERNET permission?)

What is causing this error and how can I resolve it? Below is my AndroidManifest.xml file. I am using Volley for network requests.

是什么导致了这个错误,我该如何解决呢?下面是我的AndroidManifest。xml文件。我正在对网络请求使用截击。

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
    android:name="com.my.myfirstandroidapp.app.common.MYApplication">

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

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="18" />


    <activity
        android:name="com.my.myfirstandroidapp.app.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

</application>

1 个解决方案

#1


4  

You need to define uses-permission tag before application tag. As below

您需要在应用程序标记之前定义“使用-权限”标记。如下

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

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="com.my.myfirstandroidapp.app.common.MYApplication">

<uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="18" />


<activity
    android:name="com.my.myfirstandroidapp.app.MainActivity"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

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

#1


4  

You need to define uses-permission tag before application tag. As below

您需要在应用程序标记之前定义“使用-权限”标记。如下

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

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="com.my.myfirstandroidapp.app.common.MYApplication">

<uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="18" />


<activity
    android:name="com.my.myfirstandroidapp.app.MainActivity"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

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