Closed admincode1 closed 3 months ago
Please provide a link to a repository hosting a minimal app that can reproduce the issue. If it helps, you can start by forking the repository to tweak the example app there so there's a reproducible case of the issue
hi, I am having exact same issue. I have almost exact android xml file (as in example folder) and have tried sending notification with and without sound (android) and get below errors. This issue does not occurs in IOS.
E/MethodChannel#dexterous.com/flutter/local_notifications(14602): Failed to handle method call E/MethodChannel#dexterous.com/flutter/local_notifications(14602): java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Intent.setAction(java.lang.String)' on a null object reference E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:263) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:1263) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:1622) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:1428) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at android.os.Handler.handleCallback(Handler.java:938) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at android.os.Handler.dispatchMessage(Handler.java:99) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at android.os.Looper.loop(Looper.java:223) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at android.app.ActivityThread.main(ActivityThread.java:7656) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) E/MethodChannel#dexterous.com/flutter/local_notifications(14602): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) I/flutter (14602): Error showing notification with no sound: PlatformException(error, Attempt to invoke virtual method 'android.content.Intent android.content.Intent.setAction(java.lang.String)' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Intent.setAction(java.lang.String)' on a null object reference I/flutter (14602): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:263) I/flutter (14602): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:1263)
In my case this related to workmanager plugin. Closing since this is not Flutter Local Notifications plugin issue. Thanks @MaikuB
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): Failed to handle method call E/MethodChannel#dexterous.com/flutter/local_notifications(26031): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at android.content.ComponentName.(ComponentName.java:132)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at android.content.Intent.(Intent.java:8269)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.zonedScheduleNotification(FlutterLocalNotificationsPlugin.java:577)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.zonedSchedule(FlutterLocalNotificationsPlugin.java:1610)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:1431)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at android.os.Handler.handleCallback(Handler.java:958)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at android.os.Looper.loopOnce(Looper.java:230)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at android.os.Looper.loop(Looper.java:319)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at android.app.ActivityThread.main(ActivityThread.java:8919)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
E/MethodChannel#dexterous.com/flutter/local_notifications(26031): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)