FLAG_IMMUTABLE or FLAG_MUTABLE Android Origin: On your device OSI layer 7 · Application Last updated 12 Oct 2026

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent

Apps targeting Android 12+ must declare PendingIntent mutability; missing flags crash.

Exact message you may see requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntentTargeting S+ (version 31 and above)
Seen on: Android

Meaning

Add PendingIntent.FLAG_IMMUTABLE for most cases (notifications, alarms). Use FLAG_MUTABLE only when the system must fill in extras (inline reply, bubbles). Old libraries (WorkManager < 2.7, old Firebase/Play Services) also crash — update them.

Common causes

  • PendingIntent created without mutability flag
  • Outdated library creating PendingIntents (WorkManager, analytics SDKs)

⚡ Quick fix

  1. Add FLAG_IMMUTABLE (or FLAG_MUTABLE when required)
  2. Update WorkManager/Firebase/Play Services libraries

Detailed fix by platform

Kotlin

  1. val pi = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)

How to diagnose

  1. Caller — Your code or a dependency?
  2. Versions — WorkManager ≥ 2.7?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

ActivityNotFoundException — ActivityNotFoundException: Unable to find explicit activity class; have you declared this activity in your AndroidManifest.xml? (Android)ActivityNotFoundExcep…adb unauthorized — adb: device unauthorized. This adb server's $ADB_VENDOR_KEYS is not set (Android)adb unauthorizedAndroid resource linking failed — AAPT: error: resource x (aka y) not found — Android resource linking failed (Android)Android resource link…android:attr/lStar not found — AAPT: error: resource android:attr/lStar not found (Android)android:attr/lStar no…no devices/emulators found — adb: no devices/emulators found / error: device not found (Android)no devices/emulators …RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED — SecurityException: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts (Android)RECEIVER_EXPORTED or …startForeground not called — Context.startForegroundService() did not then call Service.startForeground() / ForegroundServiceStartNotAllowedException (Android)startForeground not c…FLAG_IMMU…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.