【问题标题】:Why can not I import 'androidx.core.app.NotificationChannelCompat'?为什么我不能导入 'androidx.core.app.NotificationChannelCompat'?
【发布时间】:2020-12-23 06:40:10
【问题描述】:

我正在使用androidx.core.app.NotificationChannelandroidx.core.app.NotificationChannelCompat根据(Androidx API参考)[https://developer.android.google.cn/reference/androidx/core/app/NotificationChannelCompat]解决android兼容问题。

但即使我在 build.gradle 文件中添加implementation "androidx.core:core:1.3.1,Android Studio 也会提示我无法解析符号NotificationChannelCompat

为什么?我不想使用 SDK 版本的条件语句来填充我的源代码。

【问题讨论】:

  • 在“刷新 Gradle 项目”之后尝试“清理构建”。
  • @FelixFavourChinemerem 谢谢你的评论。但我找不到“清理构建”菜单项。我刚刚发现“无效缓存/重启......”,但它没有任何帮助。
  • 你试过重启你的电脑吗?
  • @FelixFavourChinemerem 请您启动一个空项目来验证它吗?非常感谢。

标签: android android-notifications android-support-library androidx


【解决方案1】:

如果你改变它会解析NotificationChannelCompat

 implementation "androidx.core:core:1.3.2"

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

最新版本:https://developer.android.com/jetpack/androidx/releases/core

这是提交,它丢失了 :-) https://android-review.googlesource.com/c/platform/frameworks/support/+/1360061

【讨论】:

    猜你喜欢
    • 2018-08-30
    • 2018-01-12
    • 2021-11-24
    • 2020-04-24
    • 2017-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多