Manifest.permission.POST_NOTIFICATIONS shows red or does not resolve
Unresolved reference: POST_NOTIFICATIONSShort 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.
Fix it fast
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/src2Match what you see, then jump to its fix
- 1
Unresolved reference or Cannot resolve symbol on Manifest.permission.POST_NOTIFICATIONS, and the compileSdk line shows a number below 33compileSdk is lower than 33Fix - 2
Only the word Manifest is red, or Manifest resolves to your own package's classThe import is missing or points at another Manifest classFix - 3
The code compiles, but on Android 13 and above notifications are off and no dialog appearsThe permission is not declared in the manifestFix - 4
The request code also runs on devices below Android 13The request runs on a device older than Android 13Fix
- 1
What does the error look like?
Unresolved reference: POST_NOTIFICATIONSCannot 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:assembleDebugConfirmed by developer.android.com
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/src2Fix
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:compileDebugKotlinConfirmed by developer.android.com
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.xml2Fix
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_NOTIFICATIONSConfirmed by developer.android.com
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/src2Fix
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:assembleDebugConfirmed by developer.android.com
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:
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- Nuclear Home VideoA video-streaming Android app built from scratch, engineered for smooth playback.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
Related fixes
Mobile apps
AGP 9 marks the android block as deprecated or fails on BaseExtension
java.lang.ClassCastException: class com.android.build.gradle.internal.dsl.ApplicationExtensionImpl$AgpDecorated_Decorated cannot be cast to class com.android.build.gradle.BaseExtension
AGP 9.0 uses only the new public DSL interfaces.
3 causes, each with a fixMobile apps
The editor cannot find R, so every R.string and R.id turns red
Unresolved reference: R
R is a class that the build generates from your res folder, in the package named by the module's namespace.
4 causes, each with a fixMobile apps
Android Studio says it could not identify the launch activity when you press Run
Run > Edit Configurations > Launch Options is set to Nothing or to a class that no longer exists
Android Studio launches the activity marked with a MAIN action and a LAUNCHER category in the merged manifest.
3 causes, each with a fixMobile apps
FirebaseInstanceIdService and FirebaseInstanceId.getToken() no longer work
Deprecation warning on FirebaseInstanceId.getInstance().getToken()
Move token handling into a class that extends FirebaseMessagingService and override onNewToken, which runs when a token is first created and whenever it changes.
2 causes, each with a fixMobile apps
Java and Kotlin compile to different JVM targets in an Android module
Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'kaptGenerateStubsDebugKotlin' (17)
Java and Kotlin tasks in the same module are compiling for different JVM targets, for example 1.8 and 17.
2 causes, each with a fixMobile apps
Android Studio installs the app but cannot start the activity
The Run window shows an error that the activity class does not exist
The APK installed, but the activity named in the launch request is not in it.
2 causes, each with a fix