RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED 🤖 Android

SecurityException: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

Apps targeting Android 14 must say whether a runtime-registered BroadcastReceiver is exported.

Seen on: Android

Meaning

registerReceiver() without the flag crashes on Android 14 for non-system broadcasts. Use ContextCompat.registerReceiver with RECEIVER_NOT_EXPORTED for in-app broadcasts. Old libraries can cause it too — update them.

Common causes

  • registerReceiver without export flag (targetSdk 34)
  • Third-party SDK registering receivers the old way

⚡ Quick fix

  1. Pass ContextCompat.RECEIVER_NOT_EXPORTED (or EXPORTED when other apps must send)
  2. Update SDKs that crash

Detailed fix by platform

Kotlin

  1. ContextCompat.registerReceiver(this, receiver, IntentFilter("com.example.ACTION"), ContextCompat.RECEIVER_NOT_EXPORTED)

How to diagnose

  1. Caller — Your code or a library (stack trace)?
  2. Target — targetSdk 34+?

🔧 Still not fixed?

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

🧠 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.