从昨天3月11日开始,我开始看到SecurityException崩溃的激增。(请参见下面的堆栈跟踪。)其他人也看到了这个异常吗?搜索没有找到任何结果。
我的问题是升级到新版本的Play服务是否可以解决这个问题。
以下是堆栈跟踪:
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()
我计划发布一个补丁,在loadAd()的调用周围加上try/catch。我还计划在不久的将来升级PlayServices 6.1.71到6.5.87,但我不愿意在补丁发布中引入这种风险,除非它是一个已知的修复方法。
我在这里向Google报告了这个错误:https://groups.google.com/forum/#!category-topic/google-admob-ads-sdk/android/IuSQriNWKps 编辑/澄清: 我知道可以通过请求GET_TASKS权限来避免这个SecurityException,但我的应用程序不需要该权限,我也不明白为什么AdMob广告需要。
我也知道GET_TASKS已经在API 21中被弃用,但此应用程序针对API 19。