崩溃的应用程序是一个遗留的应用程序,仍然使用GCM进行通知,没有任何支持,但当我将应用程序升级到Target sdk API 33时,它开始在Android API 31或更高版本的手机中崩溃,并开始引发以下异常:
java.lang.IllegalArgumentException:
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 depenat android.app.PendingIntent.checkPendingIntent(PendingIntent.java:428)
at android.app.PendingIntent.checkPendingIntent(PendingIntent.java:428)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:731)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:718)
at com.google.android.gms.iid.zzl.zzi(Unknown Source:18)
at com.google.android.gms.iid.zzl.zzb(Unknown Source:224)
at com.google.android.gms.iid.zzl.zza(Unknown Source:0)
at com.google.android.gms.iid.InstanceID.zzb(Unknown Source:60)
at com.google.android.gms.iid.InstanceID.getToken(Unknown Source:120)
字符串
当我调试时,我发现应用程序在以下行崩溃:
regid = instanceID.getToken(SENDER_ID, GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
型
没有将GCM更新到Firebase的选项,因为这需要大量的工作和资源。
1条答案
按热度按时间rxztt3cl1#
您必须更新firebase messaging sdk版本到最新版本当前最新版本是23. 3. 1