The build () method is undefined for the Notification.Builder

advertisements

Error: The method build() is undefined for the type Notification.Builder

I have add android-support-v4.jar still I got error ?

Notification notification = new Notification.Builder(context)
        .setContentText(message)
        .setContentTitle(context.getString(R.string.app_name))
        .setSmallIcon(icon)
        .setWhen(when)
        .setContentIntent(intent).build();


My guess is that your android-support-v4.jar is too old. build() was added about a year ago, but well after the Android Support package was first released.

Ensure that you have the latest Android Support package downloaded in your SDK Manager, then copy over the latest android-support-v4.jar from the extras/ directory of your SDK into your project.