NotificationCompat.Builder missing build() method

喜夏-厌秋 提交于 2019-12-01 04:38:48

问题


I want to do exactly, what he does: Android Notification at time But in my AlarmReceiver class, I have an error: The method build() is undefined for the type NotificationCompat.Builder, at line: mNotificationManager.notify(1, mBuilder.build());

In android developer site is a similar code, but the same error appears(http://developer.android.com/training/notify-user/build-notification.html).

Any help is greatly appreciated.


回答1:


You may be on an older version of the Android Support package. Make sure that your project has a current copy of android-support-v4.jar or android-support-v13.jar in libs/.




回答2:


It appears that there's a broken version of the Android Support package out there. Specifically, the one currently being deployed in ActionBarSherlock.

I'd recommend always using the latest android-support-v4.jar from inside the Android SDK. You'll find it in [android-sdk]/extras/android/support/v4.



来源:https://stackoverflow.com/questions/17676431/notificationcompat-builder-missing-build-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!