2

I have next crash on android 4.4

Fatal Exception: android.app.RemoteServiceException
Bad notification posted from package myapp: 
Couldn't create icon: StatusBarIcon(pkg=myappr=0 id=0x7f080117 level=0 visible=true num=0 )

I realized that the problem is in the setsmallIcon method. People write that before API 21 you need to use PNG, and then you can use vector. okay, I do.

Here's how I do

NotificationCompat.Builder builder 
= new NotificationCompat.Builder(getBaseContext(), REMINDER_CHANNEL_ID)            
.setSmallIcon(Build.VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP ? R.drawable.ic_notification : R.mipmap.ic_notification)

drawable.ic_notification is xml, mipmap.ic_notification is png for mdpi, hdpi, xhdpi, xxhdpi. Tell me, please, how to deal with this problem? I read a lot of topics, but the distinct answer have not received. Thanks

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Nikitc
  • 795
  • 1
  • 6
  • 12

0 Answers0