17

Starting yesterday, March 11, I started seeing a spike in SecurityException crashes. (See stack trace below.) Are others seeing this exception as well? Searches haven't turned up anything.

My question is whether upgrading to a newer version of Play Services fixes the issue.

Here's the stack:

java.lang.SecurityException: Permission Denial: getTasks() from pid=30319, uid=10157 requires android.permission.GET_TASKS
   at android.os.Parcel.readException(Parcel.java:1474)
   at android.os.Parcel.readException(Parcel.java:1428)
   at android.app.ActivityManagerProxy.getTasks(ActivityManagerNative.java:2726)
   at android.app.ActivityManager.getRunningTasks(ActivityManager.java:791)
   at android.app.ActivityManager.getRunningTasks(ActivityManager.java:827)
   at com.google.android.gms.ads.internal.util.h.a(SourceFile:703)
   at com.google.android.gms.ads.internal.a.a(SourceFile:1634)
   at com.google.android.gms.ads.internal.a.a(SourceFile:530)
   at com.google.android.gms.ads.internal.client.t.onTransact(SourceFile:81)
   at android.os.Binder.transact(Binder.java:361)
   at com.google.android.gms.internal.bd$a$a.a()
   at com.google.android.gms.internal.bh.a()
   at com.google.android.gms.ads.doubleclick.PublisherAdView.loadAd()

I plan to publish a patch with a try/catch around the call to loadAd(). I also plan to upgrade from PlayServices 6.1.71 to 6.5.87 in the near future, but I'm reluctant to introduce that risk in a patch release unless it's a known fix.

I have reported the bug to Google here: https://groups.google.com/forum/#!category-topic/google-admob-ads-sdk/android/IuSQriNWKps

Edit/Clarification: I am aware that this SecurityException could be avoided by requesting the GET_TASKS permission, but I don't need that permission for my app, and I don't see why AdMob ads should, either.

I am also aware that GET_TASKS has been deprecated as of API 21, but this app targets API 19.

4
  • 1
    Same here, a LOT of these now. Bundling AdMob inside Google Play Services is not the brightest of ideas that Google have had. News bugs every month and we must wait weeks for a fix. Mar 12, 2015 at 21:18
  • 1
    Yes, I see a lot of these crashes too. Found a crash report here, groups.google.com/forum/#!category-topic/google-admob-ads-sdk/…. Not sure if you've reported this. Hope they roll out a new version soon. May make sense to just add the permission ourselves till then.
    – MRK
    Mar 13, 2015 at 6:17
  • I have been seeing happen too. I think I will do what @MRK said to just add the permission till the issue has been fixed. Mar 13, 2015 at 10:51
  • Same here. Adding the permission is not my choice. I don't want a permission like that to appear in my app as my app does not even need that. It will make the users wonder...
    – A.J.
    Mar 13, 2015 at 18:39

2 Answers 2

14

This is either because you do not have GET_TASKS added in your manifest

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

Or because it has been deprecated in API 21, see more information about how to get similar information without the GET_TASKS enter link description here

2
  • 2
    Thanks, @dthacker. I'm aware that I could request the GET_TASKS permission, but my app doesn't need it, and I don't see why AdMob ads should need it, either. The version of the app in question has been hosting ads successfully for two months, and only yesterday did I start to see this exception. Mar 12, 2015 at 20:43
  • as of 2020 'GET_TASKS' is deprecated
    – Abu Nayem
    Apr 8, 2020 at 3:58
5

Google reports that a fix has been released, and that we "should see the incidence rate of that particular exception decrease, and within a week disappear entirely". Furthermore, it is a server-side fix, and does not require an upgrade to Play Services.

The full conversation is available here: https://groups.google.com/forum/#!category-topic/google-admob-ads-sdk/android/IuSQriNWKps

Meanwhile, you can either catch the SecurityException and allow the call to loadAd() to fail, or -- as @dthacker noted -- you can include the GET_TASKS permission in AndroidManifest.xml. If you choose to include this permission, note that you remove it once you target API 21, as the permission is no longer enforced (apparently because they have reduced the amount of information provided, now that document-oriented tasks could result in privacy leaks).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.