Android:java.lang.SecurityException - 尽管声明了<uses-permission>

时间:2015-06-03 09:25:21

标签: android

我在我的应用程序中收到了一些SecurityException,可能是由于缺少权限。它很少发生,似乎并不一致,有点像“一次在蓝色的月亮”。我无法访问任何崩溃的设备。它似乎发生在不同的制造商和Android版本。

到目前为止,我已经完成了null检查AndroidManifest.xml并且它是在正确的范围内,作为<uses-permission>的直接孩子,一切似乎都很好。下面是我的AndroidManifest.xml - 为了便于阅读,缩短了一点。我试图谷歌它,我在Google网上论坛上发现了类似的问题,这似乎也没有解决:https://groups.google.com/forum/#!topic/android-c2dm/QIjbqO38rHI

<mainfest>

我已经包含了几个堆栈跟踪,我从崩溃记者那里获得了设备信息。

清单中第一个缺少的<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.eTilbudsavis.eTilbudsavis" > <!-- SOME PERMISSIONS E.T.C. REMOVED FOR READABILITY --> <uses-permission android:name="android.permission.INTERNET" /> <!-- THE PERMISSION'S THAT CAUSES CRASHES --> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" /> <application android:name="com.eTilbudsavis.eTilbudsavis.App" android:allowBackup="true" android:icon="@drawable/ic_app" android:label="@string/app_name" > <activity android:name="com.eTilbudsavis.eTilbudsavis.MainActivity" android:configChanges="orientation|keyboard|keyboardHidden|screenSize" android:label="@string/app_name" android:launchMode="singleTop" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.eTilbudsavis.eTilbudsavis.test.TestActivity" > </activity> <!-- ACTIVITIES, SERVICES, RECIEVERS REMOVED FOR READABILITY --> </application> </manifest> 。设备:索尼Xperia Z1 Compact(D5503,运行Android 5.0.2)和三星Galaxy S III(I9300,运行Android 4.3)。

com.google.android.c2dm.permission.RECEIVE

第二个缺少java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) } without permission com.google.android.c2dm.permission.RECEIVE at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1730) at android.app.ContextImpl.startService(ContextImpl.java:1707) at android.content.ContextWrapper.startService(ContextWrapper.java:515) at com.google.android.gms.gcm.GoogleCloudMessaging.zzs() at com.google.android.gms.gcm.GoogleCloudMessaging.register() at com.eTilbudsavis.eTilbudsavis.notification.GcmRegistration.run(GcmRegistration.java:42) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) ,它也在主要节点中定义。设备:华为Ascend P7(P7-L10,运行Android 4.4.2)

android.permission.ACCESS_NETWORK_STATE

第三个第二个缺少java.lang.SecurityException: ConnectivityService: Neither user 10184 nor current process has android.permission.ACCESS_NETWORK_STATE. at android.os.Parcel.readException(Parcel.java:1475) at android.os.Parcel.readException(Parcel.java:1429) at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo(IConnectivityManager.java:843) at android.net.ConnectivityManager.getActiveNetworkInfo(ConnectivityManager.java:635) at com.eTilbudsavis.eTilbudsavis.ConnectionChecker.isOnline(ConnectionChecker.java:67) at com.eTilbudsavis.eTilbudsavis.ConnectionChecker.run(ConnectionChecker.java:42) ,它也在主要节日中定义。设备:三星Galaxy Tab S 8.4(SM-T705,运行Android 4.4.2)

android.permission.WRITE_EXTERNAL_STORAGE

感谢任何帮助。

0 个答案:

没有答案