当我更新Xamarin Android head以使用Android 12编译,并将最低版本更改为10.0,目标更改为12.0时,应用程序启动时出现以下异常:Java.Lang.IllegalArgumentException: '[Package Name]: 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:196)
at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:128)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:93)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
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)
现在我的项目不包含这样的PendingIntent
,所以我想知道我应该做什么。
1条答案
按热度按时间nfg76nw01#
在这种情况下,添加
Xamarin.AndroidX.Work.Runtime
NuGet软件包就可以了。一般来说,这种异常可能意味着依赖软件包没有更新以支持Android 12的这一要求。