【问题标题】:NotificationCompat.Builder missing build() methodNotificationCompat.Builder 缺少 build() 方法
【发布时间】:2013-07-16 12:23:33
【问题描述】:

我想做什么,他做什么:Android Notification at time 但是在我的 AlarmReceiver 类中,我遇到了一个错误:NotificationCompat.Builder 类型的方法 build() 未定义,位于:mNotificationManager.notify(1, mBuilder.build());

在android开发者网站有类似的代码,但出现同样的错误(http://developer.android.com/training/notify-user/build-notification.html)。

非常感谢任何帮助。

【问题讨论】:

    标签: android android-intent notifications alarmmanager


    【解决方案1】:

    您可能使用的是旧版本的 Android 支持包。确保您的项目在libs/ 中具有android-support-v4.jarandroid-support-v13.jar 的当前副本。

    【讨论】:

    • 或使用 new NotificationCompat.Builder(context) for target >= Honeycomb 如另一个问题所述!
    【解决方案2】:

    似乎存在损坏的 Android 支持包版本。具体来说,the one currently being deployed in ActionBarSherlock

    我建议始终使用 Android SDK 中最新的 android-support-v4.jar。您可以在 [android-sdk]/extras/android/support/v4 中找到它。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-12-09
    • 1970-01-01
    • 2021-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多