Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE although I'm not using any pendingIntent in application

Viewed 1118

I have already found similar answers for this but nothing work with my problem as I am getting this exception as-

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.

But this contains a condition as - I am not using any PendingIntent in my application . So its obvious that I cannot change the format of using it. I have these firebase dependencies-

implementation 'androidx.work:work-runtime-ktx:2.7.1'
implementation 'com.google.firebase:firebase-core:21.0.0'
implementation 'com.google.firebase:firebase-messaging:23.0.0'
implementation 'com.google.firebase:firebase-iid:21.1.0' // add this

Can anyone please help!! what should I do for Android 12 simply API calling Using retrofit and observable and observers in presenter layer

2 Answers

But this contains a condition as - I am not using any PendingIntent in my application .

Something in your app is using a PendingIntent. It might be from a library. The full stack trace should give you more details.

So its obvious that I cannot change the format of using it.

You would change the format by using an updated version of the library. For example, com.google.firebase:firebase-messaging has a 23.0.6 patch version which might address the problem. If you cannot identify the specific library to update from the stack trace, make sure all of your libraries are up to date.

I got a similar error when receiving push messages even if I have not personally used PendingIntent in my application. It turns out that the error was coming from the Firebase library. I upgraded the Firebase library by replacing the following in build.gradle:

implementation 'com.google.firebase:firebase-messaging:18.2.0'

with

implementation 'com.google.firebase:firebase-messaging:23.0.0'
implementation "com.google.firebase:firebase-iid:21.1.0"
Related