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

Attachments not working: java.lang.ClassCastException: android.text.SpannableStringBuilder cannot be cast to java.util.ArrayList #46

Open
Mmisiek opened this issue Oct 3, 2021 · 5 comments

Comments

@Mmisiek
Copy link

Mmisiek commented Oct 3, 2021

Sending attachments broke recently:

I/ViewRootImpl@477a313[MainActivity](32228): ViewPostIme pointer 1
I/flutter (32228): /data/user/0/com.pestscope.pestscopemobile/cache117490004--13.pdf
W/NetworkRequest(32228): No App Check token for request.
2
I/System.out(32228): (HTTPLog)-Static: isSBSettingEnabled false
I/flutter (32228): Bytes loaded:7583132
W/Bundle  (32228): Key android.intent.extra.TEXT expected ArrayList<CharSequence> but value was a android.text.SpannableStringBuilder.  The default value <null> was returned.
W/Bundle  (32228): Attempt to cast generated internal exception:
W/Bundle  (32228): java.lang.ClassCastException: android.text.SpannableStringBuilder cannot be cast to java.util.ArrayList
W/Bundle  (32228): 	at android.os.BaseBundle.getCharSequenceArrayList(BaseBundle.java:1343)
W/Bundle  (32228): 	at android.os.Bundle.getCharSequenceArrayList(Bundle.java:1145)
W/Bundle  (32228): 	at android.content.Intent.getCharSequenceArrayListExtra(Intent.java:9005)
W/Bundle  (32228): 	at android.content.Intent.migrateExtraStreamToClipData(Intent.java:12041)
W/Bundle  (32228): 	at android.app.Instrumentation.execStartActivity(Instrumentation.java:1721)
W/Bundle  (32228): 	at android.app.Activity.startActivityForResult(Activity.java:5377)
W/Bundle  (32228): 	at android.app.Activity.startActivityForResult(Activity.java:5335)
W/Bundle  (32228): 	at com.dataxad.flutter_mailer.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:73)
W/Bundle  (32228): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
W/Bundle  (32228): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
W/Bundle  (32228): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
W/Bundle  (32228): 	at android.os.MessageQueue.nativePollOnce(Native Method)
W/Bundle  (32228): 	at android.os.MessageQueue.next(MessageQueue.java:335)
W/Bundle  (32228): 	at android.os.Looper.loop(Looper.java:206)
W/Bundle  (32228): 	at android.app.ActivityThread.main(ActivityThread.java:8595)
W/Bundle  (32228): 	at java.lang.reflect.Method.invoke(Native Method)
W/Bundle  (32228): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
W/Bundle  (32228): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
I/ViewRootImpl@477a313[MainActivity](32228): MSG_WINDOW_FOCUS_CHANGED 0 1

traced error to Android 4 bug:
https://stackoverflow.com/questions/15776416/java-lang-classcastexception-android-text-spannablestringbuilder-cannot-be-cast

@taljacobson
Copy link
Owner

can you provide more context?
how did does it break?

that error message is unfortunately the same as with #13 / cordova-plugin-email although annoying has been there since forever and does not crash the app.

@Mmisiek
Copy link
Author

Mmisiek commented Oct 4, 2021 via email

@Mmisiek
Copy link
Author

Mmisiek commented Oct 4, 2021

So it does not crash app but makes FlutterMailer unusable to send attachments. In the links I provided there are some workarounds proposed.

@BellRampion
Copy link

I am seeing this issue and the workarounds are Java-specific. The issue is appearing on the newest versions of Android as well.

@bhavin-qfonapp
Copy link

any solution??

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

4 participants