权限被拒绝可能缺少互联网许可。添加广告网络时强制关闭错误

时间:2014-05-09 07:38:53

标签: android eclipse permissions

我已经看到很多关于堆栈溢出这个问题的问题。我有同样的问题,如下面这个问题,但情况稍有变化。
点击here
首先我使用的是Eclipse 其次,我在正确的位置拥有“在应用程序标签之外”的权限。我有互联网和access_network_state的权限。
我不知道问题出在哪里。你的帮助将被视为 这是我的清单代码。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0" android:installLocation="auto">

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

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

<uses-permission android:name="android.persmission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.persmission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.persmission.SET_WALLPAPER" />
<uses-permission android:name="android.persmission.READ_PHONE_STATE" />
<uses-permission android:name="android.persmission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.persmission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.persmission.ACCESS_FINE_LOCATION" />
<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.test.MainMenuActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <activity 
        android:name="com.example.test.GamePlayActivity"
        android:screenOrientation="portrait">

    </activity>


    <!-- Heyzap Ads Start  -->
        <activity
            android:name="com.heyzap.sdk.ads.HeyzapInterstitialActivity"
            android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />

        <receiver android:name="com.heyzap.sdk.ads.PackageAddedReceiver" >
            <intent-filter>
                <data android:scheme="package" />

            <action android:name="android.intent.action.PACKAGE_ADDED" />
        </intent-filter>
    </receiver>

    <!-- Heyzap Ads Ends   -->



</application>

以下是此应用程序的日志

05-10 12:20:40.058: E/AndroidRuntime(8535): FATAL EXCEPTION: Thread-8341 05-10 12:20:40.058: E/AndroidRuntime(8535): java.lang.SecurityException: ConnectivityService: Neither user 10098 nor current process has android.permission.ACCESS_NETWORK_STATE. 05-10 12:20:40.058: E/AndroidRuntime(8535): at android.os.Parcel.readException(Parcel.java:1425) 05-10 12:20:40.058: E/AndroidRuntime(8535): at android.os.Parcel.readException(Parcel.java:1379) 05-10 12:20:40.058: E/AndroidRuntime(8535): at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo(IConnectivityManager.java:680) 05-10 12:20:40.058: E/AndroidRuntime(8535): at android.net.ConnectivityManager.getActiveNetworkInfo(ConnectivityManager.java:476) 05-10 12:20:40.058: E/AndroidRuntime(8535): at com.heyzap.internal.Connectivity.connectionType(Unknown Source) 05-10 12:20:40.058: E/AndroidRuntime(8535): at com.heyzap.sdk.ads.FetchRequest.getParams(Unknown Source) 05-10 12:20:40.058: E/AndroidRuntime(8535): at com.heyzap.sdk.ads.FetchManager.fetch(Unknown Source) 05-10 12:20:40.058: E/AndroidRuntime(8535): at com.heyzap.sdk.ads.InterstitialAd.fetch(Unknown Source) 05-10 12:20:40.058: E/AndroidRuntime(8535): at com.heyzap.sdk.ads.InterstitialAd.fetch(Unknown Source) 05-10 12:20:40.058: E/AndroidRuntime(8535): at com.heyzap.sdk.ads.HeyzapAds$1.run(Unknown Source) 05-10 12:20:40.058: E/AndroidRuntime(8535): at java.lang.Thread.run(Thread.java:856)

1 个答案:

答案 0 :(得分:0)

我刚解决了这个问题,但无法得到问题的正当理由和有效解决方案 我刚刚在manifest中添加了两次access_network_state权限。现在我的清单权限看起来像这样。

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

这对我有用。