'Application crashes in Android 12 and S versions because of PendingIntent

I know there are multiple answers to these questions, I tried them all which were suggested in other StackOverflow posts, such as

  • Using FlagImmutable, I changed all of the flags of PendingIntents
  • used the work-manager library in my app module, the stable one
  • Updated FireBase But still, application crashes in Android 12 and I get the following error: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source