Invalid notification (no valid small icon)

115 Views Asked by At

I created my app Icon using flutter_launcher_icons

flutter_launcher_icons:
  android: true
  ios: false
  image_path: 'assets/icon/gradiary_icon.png'
  adaptive_icon_background: '#ffffff'
  min_sdk_android: 21 # android min sdk min:16, default 21

this replaced the default flutter icon.

Since I'm using awesome_notification, i have this initialization code

Future<void> initialiseNotifications() async {
    await AwesomeNotifications().initialize(
      null,
      [
        NotificationChannel(
          channelKey: 'reflection',
          channelName: 'Reflection Channel',
          channelDescription: 'Channel for reflection notifications',
          defaultColor: Colors.purple,
          ledColor: Colors.purple,
          enableVibration: true,
          defaultRingtoneType: DefaultRingtoneType.Alarm,
        ),

As you can see there ist "null" as the default icon, which worked before. But when I run a notification i get this error:

Invalid notification (no valid small icon):

In my src/main/res folder there is my the icon in each mipmap folder.

How can i fix this?

1

There are 1 best solutions below

0
ajinkya aher On

If You are using the awesome_notification package so while intialising the package inside your project just spacify the res/drawable/image_name location inside that function.

Note: Image should be transparent and should be present at that location.

AwesomeNotifications().initialize(
  'resource://drawable/image_name',
  [
    NotificationChannel(
        channelKey: 'new_channel',
        channelName: 'New Channel',
        channelDescription: 'Channel with call ringtone',
        defaultColor: const Color(0xFFFFFFFF00),
        importance: NotificationImportance.High,
        ledColor: Colors.white,
        channelShowBadge: true,
        locked: false,
        playSound: false,
        enableVibration: true,
        vibrationPattern: mediumVibrationPattern,
        defaultRingtoneType: null)
  ],
);