Caused by: java.lang.SecurityException: Permission Denial: getTasks() from pid=1010, uid=10046 requires android.permission.GET_TASKS
AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.epiclapser.noprocrastinate" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<uses-sdk
android:maxSdkVersion="18"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.GET_TASKS"/>
>
<activity
android:name=".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>
<activity
android:name=".MainActivity2"
android:label="@string/title_activity_main_activity2"></activity>
<activity
android:name=".LockScreen"
android:label="@string/title_activity_lock_screen"
>
</activity>
</application>
答案 0 :(得分:1)
将您的权限标记移到应用程序标记之外
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.GET_TASKS"/>
<application
android:icon="@drawable/ic_launcher"
<!--Elements inside application Tag-->
</application>