android - 错误 : adaptive icons with no fallback drawable for FCM notifications, 可能导致 Android Oreo 发生不可逆转的崩溃

标签 android firebase push-notification android-8.0-oreo pusher

今天开发一个Android应用程序时,我在logcat中收到以下错误消息:

You are targeting Android Oreo and using adaptive icons without having a fallback drawable set for FCM notifications. This can cause a irreversible crash on devices using Oreo. To learn more about this issue check: https://issuetracker.google.com/issues/68716460

我花了一段时间才弄清楚含义和该怎么做,所以我在下面添加了一个答案。

最佳答案

这是由 Pusher Beams Android SDK 生成的错误关于 Android 8.0 Oreo 中的错误的警告。参见 this article有关它的更多信息。另外,查看 this Stack Overflow Q&A .

如以上链接和 here in the documentation 中所述, 要解决该问题,请将以下 meta-data 添加到您的 AndroidManifest:

<manifest ...>
    <application...>

        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_default_notification" />
       <meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/colorAccent" />

    </application>
</manifest>

其中 ic_default_notification 是您自己创建的内容。要在 Android Studio 中制作它,请右键单击 drawable 文件夹并选择 New > Image Asset。对于图标类型,选择通知图标

enter image description here

关于android - 错误 : adaptive icons with no fallback drawable for FCM notifications, 可能导致 Android Oreo 发生不可逆转的崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56483562/

相关文章:

ios - 在 Newsstand 应用程序中,如何找到已订阅的设备列表?

自定义样式的 Android 对话框 : Remove Blue Line and set ActionBar Color

android - 我可以始终使用 WorkManager 而不是协程吗?

android 声音应用程序 sdk 或 ndk?

swift - 在 AppDelegate 中设置初始 View Controller 时完全黑屏

android - Android通知中来自外部网址的setSmallIcon

android - 将 MapView 与 fill_parent 一起使用时不显示缩放控件

javascript - 我正在尝试查询 firestore 中的时间戳

javascript - Firebase 获取对象的长度/对象中子项的数量

java - 向群组发送消息(通知) - Android