该方法构建()是未定义的类型Notification.Builder [英] The method build() is undefined for the type Notification.Builder

查看:384
本文介绍了该方法构建()是未定义的类型Notification.Builder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:该方法构建()是未定义的类型Notification.Builder

我已经加入Android的支持 - v4.jar还是我的错误?

 的通知的通知=新Notification.Builder(上下文)
        .setContentText(消息)
        .setContentTitle(context.getString(R.string.app_name))
        .setSmallIcon(图标)
        .setWhen(时)
        .setContentIntent(意向).build();


解决方案

我的猜测是,你的 Android的支持 - v4.jar 太旧。 建立()加入大约一年前,但经过好支持Android包是首次发布。

请确保你有你的SDK管理器下载了最新的Andr​​oid支持包,然后拷贝过来的最新 Android的支持 - v4.jar 演员/ 目录中的SDK到您的项目。

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.

这篇关于该方法构建()是未定义的类型Notification.Builder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆