NotificationCompat.Builder missing build() method

2019-02-17 22:35发布

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.

2条回答
Luminary・发光体
2楼-- · 2019-02-17 22:41

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.

查看更多
干净又极端
3楼-- · 2019-02-17 22:42

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/.

查看更多
登录 后发表回答