Search code examples
androidandroid-notificationsandroid-support-libraryandroidx

Why can not I import 'androidx.core.app.NotificationChannelCompat'?


I am using androidx.core.app.NotificationChannel and androidx.core.app.NotificationChannelCompat to resovle the android compatible problem according to (Androidx API reference)[https://developer.android.google.cn/reference/androidx/core/app/NotificationChannelCompat].

But even I add implementation "androidx.core:core:1.3.1 in my build.gradle file, Android Studio prompts me can not resovle symbole NotificationChannelCompat.

Why? I do not want use SDK version conditional statements to fill my source code.


Solution

  • It'll resolve NotificationChannelCompat if you change:

     implementation "androidx.core:core:1.3.2"
    

    to

     implementation "androidx.core:core:1.5.0-alpha04"
    

    Latest versions: https://developer.android.com/jetpack/androidx/releases/core

    Here is the commit, it was missing :-) https://android-review.googlesource.com/c/platform/frameworks/support/+/1360061