Describe the bug
This is a Crashlytics report, can't pinpoint exactly what's going on.
I have >140k active users and this error affected 11 users.
Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3623)
at android.app.ActivityThread.access$1300(ActivityThread.java:240)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7097)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.setupNotificationChannel(FlutterLocalNotificationsPlugin.java:584)
at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:115)
at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:634)
at com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver.onReceive(ScheduledNotificationReceiver.java:45)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3614)
at android.app.ActivityThread.access$1300(ActivityThread.java:240)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7097)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
Would need more info on what your app is doing, which version of the plugin you're using etc. The code is open-source so you can check what your app is doing to see how it relates to the crash given you have a stack trace
Also note that you can have your app point to a local copy of the plugin or via a Git reference. This could be used to track the problem and submit a PR back should you find out what the issue is
The problem is that this don't happen in any of my devices (of course, "works on my machine" 庐)
I would love to help, but I don't have any idea of what can trigger this behavior.
Anyway, flutter_local_notifications: ^0.9.1
Would the users that have those crashes have a version of your app that is using version 0.9.1 of the plugin? Line 584 of the FlutterLocalNotificationsPlugin.java file currently doesn't point to code that would deal with an integer so I suspect it's on an older version of the plugin. Regardless, without more information, this may not be something I'll be able to track down to fix. Be good if you can provide more info about what kind of code you have has well when it comes to notifications. Snippets would help.
This is a Crashlytics report, can't pinpoint exactly what's going on.
I'm using _flutter_local_notifications: ^1.4.4+4_
Can you please help me , we need to resolve this ASAP. KIndly help us @MaikuB @JCKodel
```
java.lang.RuntimeException: Unable to start receiver com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
E/AndroidRuntime( 5911): at android.app.ActivityThread.handleReceiver(ActivityThread.java:3388)
E/AndroidRuntime( 5911): at android.app.ActivityThread.access$1200(ActivityThread.java:199)
E/AndroidRuntime( 5911): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
E/AndroidRuntime( 5911): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 5911): at android.os.Looper.loop(Looper.java:193)
E/AndroidRuntime( 5911): at android.app.ActivityThread.main(ActivityThread.java:6669)
E/AndroidRuntime( 5911): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 5911): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/AndroidRuntime( 5911): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
```Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
E/AndroidRuntime( 5911): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.setSmallIcon(FlutterLocalNotificationsPlugin.java:188)
E/AndroidRuntime( 5911): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:146)
E/AndroidRuntime( 5911): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:688)
E/AndroidRuntime( 5911): at com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver.onReceive(ScheduledNotificationReceiver.java:45)
E/AndroidRuntime( 5911): at android.app.ActivityThread.handleReceiver(ActivityThread.java:3379)
After this when the schedule time is arrived, the apps gets stopped. This is my code
```Future
var androidPlatformChannelSpecifics = AndroidNotificationDetails(
'scheduler channel id',
'scheduler channel name',
'scheduler description',
importance: Importance.Max,
ledColor: Color(0xFF3EB16F),
ledOffMs: 1000,
ledOnMs: 1000,
enableLights: true,
);
var iOSPlatformChannelSpecifics = IOSNotificationDetails();
var platformChannelSpecifics = NotificationDetails(
androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
int inttaskid = int.parse(taskId);
await flutterLocalNotificationsPlugin.schedule(
inttaskid,
taskName,
"Its time and you have some tasks pending!",
_combinedDateTime,
platformChannelSpecifics,
androidAllowWhileIdle: true);
}```
Did you fix?
Yes. The integer value I've provided in dart, exceeded the limit of maximum integer value in java file. So i reduced the number within the limit of integer max value and then the issue was resolved.
Try to reduce the id value.
I just add the code in initStatus, and error didn't show. but I don't know what it is.
var initializationSettingsAndroid =
AndroidInitializationSettings('@mipmap/ic_launcher');
var initializationSettingsIOS = IOSInitializationSettings();
var initializationSettings = InitializationSettings(
initializationSettingsAndroid, initializationSettingsIOS);
flutterLocalNotificationsPlugin.initialize(
initializationSettings,
);
@yeskayviswa Thank you for replying.
Try to reduce the id value.
I pushed channel_id, ZONE_ALERT via Cloud Messaging in Firebase.
what is id ? it should be number?
The error I faced is in flutterLocalNotificationsPlugin.schedule( ) function. My inttaskid was more than the limit.
That's the id I've mentioned
Yes. The integer value I've provided in dart, exceeded the limit of maximum integer value in java file. So i reduced the number within the limit of integer max value and then the issue was resolved.
Try to reduce the id value.
Hi @yeskayviswa Sorry I'm a little noob. I'm with the same problem and using five tipes of notification (every minute, hourly, every day, every week and specific Time) I put the IDs 01, 02, 03, 04 and 05. Qhat I can do to solve this?