當我運行應用程式 android OS 11 及以下版本時,它正在運行,但在我部署應用程式時,它無法運行 Android os 12,我得到以下運行時例外。
[AndroidRuntime] 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.
[AndroidRuntime] at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
[AndroidRuntime] at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:651)
[AndroidRuntime] at android.app.PendingIntent.getBroadcast(PendingIntent.java:638)
[AndroidRuntime] at com.google.firebase.iid.zzl.zzd(Unknown Source:18)
[AndroidRuntime] at com.google.firebase.iid.zzl.zzb(Unknown Source:229)
[AndroidRuntime] at com.google.firebase.iid.zzl.zza(Unknown Source:0)
[AndroidRuntime] at com.google.firebase.iid.zzj.zzb(Unknown Source:41)
[AndroidRuntime] at com.google.firebase.iid.zzj.getToken(Unknown Source:56)
[AndroidRuntime] at com.google.firebase.iid.FirebaseInstanceId.getToken(Unknown Source:10)
[AndroidRuntime] at com.google.firebase.iid.FirebaseInstanceId.zzcfy(Unknown Source:4)
[AndroidRuntime] at com.google.firebase.iid.FirebaseInstanceIdService.zza(Unknown Source:148)
[AndroidRuntime] at com.google.firebase.iid.FirebaseInstanceIdService.handleIntent(Unknown Source:122)
[AndroidRuntime] at com.google.firebase.iid.zzc.run(Unknown Source:4)
[AndroidRuntime] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
[AndroidRuntime] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
[AndroidRuntime] at java.lang.Thread.run(Thread.java:1012)
請幫助解決這個問題。
uj5u.com熱心網友回復:
首先,您可以除錯以查找PendingIntent
您使用的導致此錯誤的原因。
如果是自己創建的,可以嘗試PendingIntentFlags.Immutable
在PendingIntentFlags.UpdateCurrent
使用PendingIntent
. 有關更多資訊,您可以查看此案例。
如果它是由您使用的 nuget 包創建的,您可以嘗試將包的版本升級到最新版本。
此外,我在上面提供的案例答案中提到的庫。它是 xamarin 中命名的 nuget 包Xamarin.AndroidX.Work.Runtime
,您可以在專案中安裝最新版本。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/507027.html
標籤:安卓 xamarin xamarin.forms xamarin.android xamarin.ios