Android Studio 无法识别 NotificationCompat.Builder.setSilent(布尔值),尽管该函数在文档中

Android Studio doesn't recognize NotificationCompat.Builder.setSilent(Boolean) although the function is in the documentation

我想使用功能setSilent(Boolean) 而不是创建 NotificationCompat.Builder 时弃用的函数 setNotificationSilent() 但是当我在 Android studio 中键入该函数时它无法识别它,我无法构建应用程序。
我检查了 NotificationCompat.Builder class 确实没有出现。
我的代码:

var notificationBuilder = NotificationCompat.Builder(this, "Schedule")
                .setSmallIcon(R.drawable.ic_calendar)
                .setContentTitle("Schedule")
                .setPriority(NotificationCompat.PRIORITY_LOW)
                .setContentIntent(pendingIntent)
                .setOngoing(true)
                .addAction(R.drawable.ic_launcher_foreground, "Stop Schedule", stopPendingIntent)
notificationBuilder.setSilent(true)

请注意,setSilent() 函数不在构建器的创建中,因为它是通过 if 语句切换的。我已经检查过了,它在两个地方都不识别它。这也是为什么使用 setSilent() 对我来说会好得多,因为我希望通知有时有声音,有时没有,而且你不能禁用 setNotificationSilent() 函数。这意味着如果我只能使用该功能,我将需要重建构建器或保留它的单独实例。

我很确定 NotificationBuilderCompat 没有 setSilent 方法,因为它已移至 priority 属性。在 setPriority 中使用 NotificationManager.IMPORTANCE_LOW 使通知静音(即没有通知声音)

好吧,我知道我哪里做错了。 我的 androidx-core 库已经过时,因此,它无法识别 setSilent(boolean) 命令,这是非常新的。

androix-core version changes,我很确定该方法是在 1.5.0-alpha-02 版本中添加的。