gdelataillade / alarm

A Flutter plugin to easily manage alarms on iOS and Android
https://pub.dev/packages/alarm
MIT License
132 stars 86 forks source link

Breaking changes on flutter local notifications 15 maybe crashing Alarm #64

Closed romarito closed 1 year ago

romarito commented 1 year ago

Alarm plugin version 1.1.5

Hi Gautier,

I have been facing difficulties when inserting the Alarm package in my new project, to identify the problem I created a new default counter flutter application and inserted only Alarm, not another plugin in pubspec.yaml, and it gave the same error when creating one alarm :

E/AndroidRuntime(22936): FATAL EXCEPTION: main
E/AndroidRuntime(22936): java.lang.NoClassDefFoundError: Failed resolution of: Ljava/time/LocalDateTime;
E/AndroidRuntime(22936):    at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.zonedScheduleNotification(FlutterLocalNotificationsPlugin.java:563)
E/AndroidRuntime(22936):    at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.zonedSchedule(FlutterLocalNotificationsPlugin.java:1542)
E/AndroidRuntime(22936):    at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:1385)
E/AndroidRuntime(22936):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
E/AndroidRuntime(22936):    at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/AndroidRuntime(22936):    at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/AndroidRuntime(22936):    at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(D8$$SyntheticClass)
E/AndroidRuntime(22936):    at android.os.Handler.handleCallback(Handler.java:751)
E/AndroidRuntime(22936):    at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(22936):    at android.os.Looper.loop(Looper.java:154)
E/AndroidRuntime(22936):    at android.app.ActivityThread.main(ActivityThread.java:6682)
E/AndroidRuntime(22936):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(22936):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
E/AndroidRuntime(22936):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
E/AndroidRuntime(22936): Caused by: java.lang.ClassNotFoundException: Didn't find class "java.time.LocalDateTime" on path: DexPathList[[zip file 

I saw in closed issues that there was a conflict when flutter_local_notifications became version 14, is it not happening again now at the turn of 15?

Thanks!

gdelataillade commented 1 year ago

Hi @romarito,

I found a similar issue in the flutter_local_notification repository: https://github.com/MaikuB/flutter_local_notifications/issues/1879

It seems like you haven't done the entire Android setup.

Make sure to follow these steps: https://pub.dev/packages/alarm#android-installation-steps

If it still doesn't work, take a look at the flutter_local_notification steps: https://pub.dev/packages/flutter_local_notifications#-android-setup

Please let me know if it fixes your issue.

romarito commented 1 year ago

The coreLibraryDesugaring solution worked, only the 1.1.5 version, the latest one (2.0.3) did not on my test device with Android 7 (SDK 24).

Didn't this already have to be inserted in your plugin, is it the one that makes direct use of flutter_local_notifications? In any case, I suggest adding this instruction to the installation instructions.

Once again thank you for your attention and help.

Greetings!