에러코드:
E/MethodChannel#.com/flutter/local_notifications( 7674): Failed to handle method call
E/MethodChannel#.com/flutter/local_notifications( 7674): java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
E/MethodChannel#.com/flutter/local_notifications( 7674): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.setSmallIcon(FlutterLocalNotificationsPlugin.java:76)
E/MethodChannel#.com/flutter/local_notifications( 7674): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:88)
flutter app android error
FlutterLocalNotificationsPlugin.setSmallIcon
안드로이드에서 FlutterLocalNotificationsPlugin을 통해 내부 알림을 보낼 때 나타나는 icon 설정이 잘못되어있기 때문에 이미지를 찾을 수 없어 알림이 안 나오는 에러!
따라서 icon 이미지만 지정해주면 해결된다:
FlutterLocalNotificationsPlugin().show(
notification.hashCode,
notification.title,
notification.body,
const NotificationDetails(
android: AndroidNotificationDetails(
'high_importance_channel',
'High Importance Notifications',
importance: Importance.max,
playSound: true,
enableVibration: true,
icon: "mipmap/app_icon", //당신의 mipmap 폴더에 있는 보여주려는 아이콘 파일명 입력. 확장자 필요없음
),
iOS: DarwinNotificationDetails(
presentAlert: true,
presentBadge: true,
presentSound: true,
presentBanner: true,
),
),
);
'에러' 카테고리의 다른 글
[Flutter] InAppWebView pull to refresh / 당겨서 새로고침 오류 (0) | 2024.09.06 |
---|---|
[Flutter] CFBundleIconFiles is not of the required type for that key (1) | 2024.08.21 |
[iOS] Core data NSCocoaErrorDomain (0) | 2024.02.20 |
[mac] zsh: command not found: pod 에러 해결 (1) | 2024.02.13 |
Android Material Date Picker 오류 (0) | 2022.01.24 |