SecurityException: Permission Denial 🤖 Android

java.lang.SecurityException: Permission Denial ... requires android.permission.X

The app called an API that needs a permission it hasn’t declared or the user hasn’t granted at runtime.

Seen on: Android

Meaning

Dangerous permissions (camera, location, notifications on Android 13+, Bluetooth on 12+) must be declared in the manifest and requested at runtime. Some APIs need special permissions or exported components.

Common causes

  • Permission missing from the manifest
  • Runtime permission not requested/granted
  • New permission required on newer Android (POST_NOTIFICATIONS, BLUETOOTH_CONNECT)
  • Accessing another app’s non-exported component

⚡ Quick fix

  1. Declare the permission and request it at runtime
  2. Check SDK-specific permissions for the target API
  3. Handle denial gracefully

Detailed fix by platform

Kotlin

  1. kotlin
    val launcher = registerForActivityResult(ActivityResultContracts.RequestPermission()) { granted -> if (granted) startCamera() }
    launcher.launch(Manifest.permission.CAMERA)

How to diagnose

  1. Permission — Which one is named?
  2. Manifest — Declared?
  3. Runtime — Granted (adb shell dumpsys package)?

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