Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start receiver com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver #408

Closed
JCKodel opened this issue Dec 27, 2019 · 19 comments

Comments

@JCKodel
Copy link

JCKodel commented Dec 27, 2019

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)
@MaikuB
Copy link
Owner

MaikuB commented Dec 27, 2019

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

@MaikuB
Copy link
Owner

MaikuB commented Dec 27, 2019

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

@JCKodel
Copy link
Author

JCKodel commented Dec 27, 2019

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

@MaikuB
Copy link
Owner

MaikuB commented Dec 27, 2019

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.

@JCKodel JCKodel closed this as completed Dec 27, 2019
@yeskayviswa
Copy link

yeskayviswa commented Aug 24, 2020

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)
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

    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);
  }```

@yourshinsuke
Copy link

Did you fix?

@yeskayviswa
Copy link

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.

@yourshinsuke
Copy link

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,
    );

@yourshinsuke
Copy link

yourshinsuke commented Aug 31, 2020

@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?

@yeskayviswa
Copy link

The error I faced is in flutterLocalNotificationsPlugin.schedule( ) function. My inttaskid was more than the limit.

That's the id I've mentioned

@mercatelli
Copy link

mercatelli commented Sep 8, 2020

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?

@dikshantrawal
Copy link

I am having an error in the android app when I have updated the flutter version and library version 9.3.2 and even9.2.0. I am getting the below error.

Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver: java.lang.RuntimeException: Missing type parameter.
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4757)
at android.app.ActivityThread.access$1800(ActivityThread.java:309)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2279)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8582)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:563)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1133)

Please help on this

@dikshantrawal
Copy link

where you have exceed the limit, can you explain this

@dikshantrawal
Copy link

dikshantrawal commented Feb 16, 2022

This is the crashlytics report when I have updated the version. And the application is crashing only in release mode.
Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver: java.lang.RuntimeException: Missing type parameter.
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3858)
at android.app.ActivityThread.access$1500(ActivityThread.java:227)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1901)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7592)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

Why it's happening??

@MaikuB
Copy link
Owner

MaikuB commented Feb 16, 2022

Make sure you've done the release build configuration

@under3415
Copy link

under3415 commented Nov 9, 2023

I am able to replicate this on my physical test device. Getting below error in crashlytics.

Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver: java.lang.RuntimeException: Missing type parameter.
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:4471)
       at android.app.ActivityThread.access$1700(ActivityThread.java:262)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2166)
       at android.os.Handler.dispatchMessage(Handler.java:111)
       at android.os.Looper.loopOnce(Looper.java:238)
       at android.os.Looper.loop(Looper.java:357)
       at android.app.ActivityThread.main(ActivityThread.java:8111)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1026)

Caused by java.lang.RuntimeException: Missing type parameter.
       at s8.a.d(:26)
       at s8.a.<init>(:7)
       at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin$a.<init>()
       at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.loadScheduledNotifications(:25)
       at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.rescheduleNotifications()
       at com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver.onReceive(:38)
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:4038)
       at android.app.ActivityThread.access$1400(ActivityThread.java:239)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1926)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7680)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:423)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

@under3415
Copy link

Seems that this is related to ProGuard and R8. As I was making changes to upgrade to AGP8, I have added this to gradle/properties file:

android.enableR8.fullMode=true

Removing this line seems to fix the issue.

@PeperMarkreel
Copy link

PeperMarkreel commented Jan 14, 2024

I have the same on my local development device, with usb attached to the debugger. A simple scheduled notification works, but somehow when I want to schedule my app specific notifications, I get this crash.

I/NotificationManager(31143): app.prog.android: notify(2000, null, Notification(channel=1 shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x10 color=0x00000000 vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0)) as user
I/NotificationManager(31143): app.prog.android: notify(2001, null, Notification(channel=1 shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x10 color=0x00000000 vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0)) as user
I/NotificationManager(31143): app.prog.android: notify(2002, null, Notification(channel=1 shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x10 color=0x00000000 vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0)) as user

D/AndroidRuntime( 9701): Shutting down VM
E/AndroidRuntime( 9701): FATAL EXCEPTION: main
E/AndroidRuntime( 9701): Process: app.prog.android, PID: 9701
E/AndroidRuntime( 9701): java.lang.RuntimeException: Unable to start receiver com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver: java.lang.IllegalArgumentException
E/AndroidRuntime( 9701): 	at android.app.ActivityThread.handleReceiver(ActivityThread.java:4905)
E/AndroidRuntime( 9701): 	at android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0)
E/AndroidRuntime( 9701): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2498)
E/AndroidRuntime( 9701): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 9701): 	at android.os.Looper.loopOnce(Looper.java:230)
E/AndroidRuntime( 9701): 	at android.os.Looper.loop(Looper.java:319)
E/AndroidRuntime( 9701): 	at android.app.ActivityThread.main(ActivityThread.java:8893)
E/AndroidRuntime( 9701): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 9701): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
E/AndroidRuntime( 9701): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
E/AndroidRuntime( 9701): Caused by: java.lang.IllegalArgumentException
E/AndroidRuntime( 9701): 	at android.os.Parcel.createExceptionOrNull(Parcel.java:3073)
E/AndroidRuntime( 9701): 	at android.os.Parcel.createException(Parcel.java:3053)
E/AndroidRuntime( 9701): 	at android.os.Parcel.readException(Parcel.java:3036)
E/AndroidRuntime( 9701): 	at android.os.Parcel.readException(Parcel.java:2978)
E/AndroidRuntime( 9701): 	at android.app.INotificationManager$Stub$Proxy.createNotificationChannels(INotificationManager.java:4604)
E/AndroidRuntime( 9701): 	at android.app.NotificationManager.createNotificationChannels(NotificationManager.java:1032)
E/AndroidRuntime( 9701): 	at android.app.NotificationManager.createNotificationChannel(NotificationManager.java:1020)
E/AndroidRuntime( 9701): 	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.setupNotificationChannel(FlutterLocalNotificationsPlugin.java:1201)
E/AndroidRuntime( 9701): 	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:251)
E/AndroidRuntime( 9701): 	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:1237)
E/AndroidRuntime( 9701): 	at com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver.onReceive(ScheduledNotificationReceiver.java:61)
E/AndroidRuntime( 9701): 	at android.app.ActivityThread.handleReceiver(ActivityThread.java:4896)
E/AndroidRuntime( 9701): 	... 9 more
E/AndroidRuntime( 9701): Caused by: android.os.RemoteException: Remote stack trace:
E/AndroidRuntime( 9701): 	at com.android.internal.util.Preconditions.checkArgument(Preconditions.java:44)
E/AndroidRuntime( 9701): 	at com.android.server.notification.PreferencesHelper.createNotificationChannel(PreferencesHelper.java:1176)
E/AndroidRuntime( 9701): 	at com.android.server.notification.NotificationManagerService$15.createNotificationChannelsImpl(NotificationManagerService.java:5627)
E/AndroidRuntime( 9701): 	at com.android.server.notification.NotificationManagerService$15.createNotificationChannels(NotificationManagerService.java:5673)
E/AndroidRuntime( 9701): 	at android.app.INotificationManager$Stub.onTransact(INotificationManager.java:2012)
E/AndroidRuntime( 9701): 
I/Process ( 9701): Sending signal. PID: 9701 SIG: 9
Lost connection to device.

Edit: found the error, turns out I sometimes asked to schedule notifications with empty string for title, body, channelid, channelName.

@gibbsvjy007
Copy link

@MaikuB

We are getting the same error suddenly, we did not change any code since many versions regarding scheduling local notification. Since last two version after upgrading the plugin to 16.0.0 we are getting the crash event for many users in firebase crashlytics. Any idea how to solve this error ? this is very important error as it has decreased our crash free users to almost 50%. Let me know if you have any idea on this.

Fatal Exception: java.lang.RuntimeException
Unable to start receiver com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver: java.lang.RuntimeException: Missing type parameter.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants