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

Exception when casting Integer to Long on Android #68

Closed
jvr0x opened this issue May 25, 2021 · 5 comments
Closed

Exception when casting Integer to Long on Android #68

jvr0x opened this issue May 25, 2021 · 5 comments

Comments

@jvr0x
Copy link

jvr0x commented May 25, 2021

E/MethodChannel#flutter.javih.com/add_2_calendar( 8514): Failed to handle method call
E/MethodChannel#flutter.javih.com/add_2_calendar( 8514): java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
E/MethodChannel#flutter.javih.com/add_2_calendar( 8514): 	at com.javih.add2calendar.Add2CalendarPlugin.onMethodCall(Add2CalendarPlugin.java:100)
E/MethodChannel#flutter.javih.com/add_2_calendar( 8514): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#flutter.javih.com/add_2_calendar( 8514): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#flutter.javih.com/add_2_calendar( 8514): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/MethodChannel#flutter.javih.com/add_2_calendar( 8514): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter.javih.com/add_2_calendar( 8514): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/MethodChannel#flutter.javih.com/add_2_calendar( 8514): 	at android.os.Looper.loop(Looper.java:183)
E/MethodChannel#flutter.javih.com/add_2_calendar( 8514): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/MethodChannel#flutter.javih.com/add_2_calendar( 8514): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter.javih.com/add_2_calendar( 8514): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/MethodChannel#flutter.javih.com/add_2_calendar( 8514): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter ( 8514): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(error, java.lang.Integer cannot be cast to java.lang.Long, null, java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
E/flutter ( 8514): 	at com.javih.add2calendar.Add2CalendarPlugin.onMethodCall(Add2CalendarPlugin.java:100)
E/flutter ( 8514): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter ( 8514): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/flutter ( 8514): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/flutter ( 8514): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter ( 8514): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter ( 8514): 	at android.os.Looper.loop(Looper.java:183)
E/flutter ( 8514): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter ( 8514): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 8514): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter ( 8514): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter ( 8514): )
E/flutter ( 8514): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:597:7)
E/flutter ( 8514): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
E/flutter ( 8514): <asynchronous suspension>
E/flutter ( 8514): 

@jvr0x
Copy link
Author

jvr0x commented May 25, 2021

This happens with add_2_calendar: ^2.1.0

@jvr0x
Copy link
Author

jvr0x commented May 25, 2021

It works fine for iOS

@jvr0x
Copy link
Author

jvr0x commented May 25, 2021

Alright this happens if the calendar app is not set up, i.e. if you don't have a google account connected to the device

@diegogarciar
Copy link
Collaborator

Thanks for the feedback, any suggestion on how to prevent this?

@diegogarciar
Copy link
Collaborator

Closing this as a check was added to prevent the crash.

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

2 participants