Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Manifest.permission.POST_NOTIFICATIONS shows red or does not resolve

ErrorUnresolved reference: POST_NOTIFICATIONS

Short answer

POST_NOTIFICATIONS exists only from API level 33. If Android Studio cannot resolve it, the module compiles against an older SDK, or the Manifest import points at the wrong class. Raise compileSdk to 33 or higher, import android.Manifest, declare the permission in the manifest and request it only on Android 13 and above.

  • Applies to Android Studio, Android 13 (API 33) and later, Kotlin, Java
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find which SDK level the module compiles against and where the permission is used. The level is the first thing to check.

    grep -rn "compileSdk" --include=*.gradle --include=*.kts .
    grep -rn "POST_NOTIFICATIONS" app/src
  2. 2Match what you see, then jump to its fix

    1. 1Unresolved reference or Cannot resolve symbol on Manifest.permission.POST_NOTIFICATIONS, and the compileSdk line shows a number below 33compileSdk is lower than 33Fix
    2. 2Only the word Manifest is red, or Manifest resolves to your own package's classThe import is missing or points at another Manifest classFix
    3. 3The code compiles, but on Android 13 and above notifications are off and no dialog appearsThe permission is not declared in the manifestFix
    4. 4The request code also runs on devices below Android 13The request runs on a device older than Android 13Fix

What does the error look like?

  • Unresolved reference: POST_NOTIFICATIONS
  • Cannot resolve symbol 'POST_NOTIFICATIONS'
  • Notifications never appear on Android 13 although the code runs

Cause 1 of 4

compileSdk is lower than 33

1Check

The API reference lists POST_NOTIFICATIONS as added in API level 33. A module that compiles against an older SDK does not contain the constant.

grep -rn "compileSdk" --include=*.gradle --include=*.kts .

2Fix

Set compileSdk in the module's build file to 33 or higher and sync Gradle. To control when the permission dialog appears, target Android 13 or higher as well.

// app/build.gradle.kts: change the number to 33 or higher
android {
    compileSdk = 33
}

3Verify

Sync the project. The symbol turns resolved and the module builds.

./gradlew :app:assembleDebug

Confirmed by developer.android.com

Did this fix it?

Cause 2 of 4

The import is missing or points at another Manifest class

1Check

The permission constants live in the platform class android.Manifest.permission. A different Manifest imported from a library or from your own package has no POST_NOTIFICATIONS.

grep -rn "import .*Manifest" app/src

2Fix

Import the platform class. Java needs a semicolon after the import.

import android.Manifest

permissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)

3Verify

Rebuild. The reference resolves to android.Manifest.permission.

./gradlew :app:compileDebugKotlin

Confirmed by developer.android.com

Did this fix it?

Cause 3 of 4

The permission is not declared in the manifest

1Check

On Android 13 or higher, notifications are off by default for a new install, and the app must request the permission. The permission must be declared in the manifest first.

grep -n "POST_NOTIFICATIONS" app/src/main/AndroidManifest.xml

2Fix

Add the uses-permission line inside the manifest element, outside the application element.

<manifest ...>
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
    <application ...>
        ...
    </application>
</manifest>

3Verify

Revoke the permission with the command below on an Android 13 or newer device, then trigger the request from your code. The system dialog appears.

adb shell pm revoke com.example.myapp android.permission.POST_NOTIFICATIONS

Confirmed by developer.android.com

Did this fix it?

Cause 4 of 4

The request runs on a device older than Android 13

1Check

The permission only exists from Android 13. The official sample guards the request with a version check.

grep -rn "TIRAMISU" app/src

2Fix

Wrap the request in a version check so older devices skip it.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
    permissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
}

3Verify

Run the app on an older emulator image and on an Android 13 or newer one.

./gradlew :app:assembleDebug

Confirmed by developer.android.com

Did this fix it?

How do I stop it coming back?

  • Keep compileSdk at the current stable level, and raise it before you add any new platform permission.
  • Check areNotificationsEnabled() before you post a notification.
  • Ask for the permission after a user action that explains why, not on first launch.
  • Test the denied path on a real Android 13 or newer device.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.