java - Firebase:NotificationCompat.Builder 错误
问题描述
我得到了一个错误,Notification.Builder
我不知道为什么这是错误:
这是我的毕业生:
dependencies {
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-iid:17.0.2'
implementation 'com.google.firebase:firebase-messaging:17.3.2'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation 'com.android.support:appcompat-v7:26.1.1'
implementation 'com.android.support:design:26.1.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:animated-vector-drawable:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:support-compat:26.1.0'
// [START gradle_play_config]
implementation 'com.google.firebase:firebase-ads:15.0.1'
}
我一直在搜索,但我只发现它应该是 android 26 及更高版本,但我仍然遇到错误。
解决方案
您的依赖项似乎没有问题。该错误只是说您传递的是 MyFirebaseMessagingService 而不是上下文。尝试:
new NotificationCompat.Builder(getContext, channelId)...
或编辑您的帖子并显示您在哪个课程中执行此操作(并写下错误,不要使用图像)。
推荐阅读
- javascript - 如何从输出中删除完整的主题标签
- angular - 更新一堆组件(*ngFor)中的一个组件
- google-sheets - 具有指定几率的多个随机选择的单元格
- excel - 在运行宏之前单击的单元格旁边添加列
- string - 想要一种使用 PowerShell 将不同字符串拆分为多个部分的通用方法
- python - Drive API v3 - 与父母一起复制
- python - 朴素贝叶斯分类器动态训练
- java - 从 JSON 数组的 POJO 序列化
- vue.js - 当页面在新选项卡中打开时,如何在 vue.js 中检测用户来自的页面?
- java - 如何防止对 OneToOne 关系的附加查询