美文网首页
PendingIntent

PendingIntent

作者: 上帝死了众神在堕落 | 来源:发表于2022-06-05 15:24 被阅读0次
java.lang.IllegalArgumentException: cn.zherui.kuaigun.idea: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
    at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
    at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
    at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
    at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:147)
    at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:124)
    at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:79)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:920)

Android 12为目标平台的App,在构建PendingIntent时,需要指定Flag为FLAG_IMMUTABLE(建议)或FLAG_MUTABLE二者之一
如果还是崩溃,缺少implementation 'androidx.work:work-runtime:2.7.1'

记录一下自己踩得坑,浪费我半天时间

相关文章

网友评论

      本文标题:PendingIntent

      本文链接:https://www.haomeiwen.com/subject/yoejmrtx.html