Closed Pirokar closed 5 years ago
Are you manually setting the text on the completion field?
Closing until I get more feedback.
Can reproduce the same issue with 3.0.1. I'm not manually setting the text on the completion field, just using the addObjectAsync method and proving model objects. Activity crashes as soon as field get focus with user interaction/touch.
I'm not attaching the crash log, because it's exactly the same with OP.
Just converting addObjectAsync to addObjectSync fixes the problem for me but I'm not sure about the root cause of this.
Thanks for the follow-up. This does sounds like something I should be able to work around. Are you able to reproduce this in the sample app?
Most likely same problem that I had and cause is TextUtils.ellipsize that can return empty String.
When it is called from SpanUtils.ellipsizeWithSpans and empty String returned it causes crash because it can not be cast to Spanned. If empty then don't cast but create new SpannedString fixed my issue.
Thanks! I should be able to make that fix pretty easily.
+1, the most common crash in the last month for my app seems to be this issue. It sounds like you've got a handle on this, but I'll throw a Google Play stacktrace here just for kicks.
java.lang.ClassCastException:
at com.tokenautocomplete.SpanUtils.ellipsizeWithSpans (SpanUtils.java:36)
at com.tokenautocomplete.TokenCompleteTextView.performCollapse (TokenCompleteTextView.java:793)
at com.tokenautocomplete.TokenCompleteTextView$6.run (TokenCompleteTextView.java:1424)
at android.os.Handler.handleCallback (Handler.java:789)
at android.os.Handler.dispatchMessage (Handler.java:98)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6944)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
+1
(seeing crash in Google Play logs)
Sorry for the delays in getting this out! Spilled coffee on my computer and still getting everything back up again.
Oh no! Sorry to hear about the coffee damage 😢
This should be all done now and available in version 3.0.2. Please let me know if you're still running into this issue!
Pulled in (https://github.com/AEFeinstein/mtg-familiar/commit/473a571d415d98d8418e46cee5c1d3bd2783b74e). I'll let you know if I see it again. Thanks!
@mgod FYI I ran into this issue after upgrading from 2. to 3. because the repo's README still refers to 3.0.1! 3.0.2 does fix it indeed, thanks.
E/MessageQueue-JNI: java.lang.ClassCastException: java.lang.String cannot be cast to android.text.Spanned at com.tokenautocomplete.SpanUtils.ellipsizeWithSpans(SpanUtils.java:36) at com.tokenautocomplete.TokenCompleteTextView.performCollapse(TokenCompleteTextView.java:793) at com.tokenautocomplete.TokenCompleteTextView.onFocusChanged(TokenCompleteTextView.java:844) at android.view.View.clearFocusInternal(View.java:7164) at android.view.View.unFocus(View.java:7197) at android.view.ViewGroup.requestChildFocus(ViewGroup.java:813) at android.view.View.handleFocusGainInternal(View.java:6989) at android.view.View.requestFocusNoSearch(View.java:11642) at android.view.View.requestFocus(View.java:11616) at android.view.View.requestFocus(View.java:11583) at android.view.View.requestFocus(View.java:11525) at android.view.View.onTouchEvent(View.java:13909) at android.widget.TextView.onTouchEvent(TextView.java:10421) at com.tokenautocomplete.TokenCompleteTextView.onTouchEvent(TokenCompleteTextView.java:701) at android.view.View.dispatchTouchEvent(View.java:12615) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:541) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1893) at android.app.Dialog.dispatchTouchEvent(Dialog.java:1001) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:490) at android.view.View.dispatchPointerEvent(View.java:12860) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5767) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5533) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5040) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5006) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5160) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5014) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5217) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5040) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5006) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5014) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7794) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7759) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7717) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7986) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:202) at android.os.MessageQueue.nativePollOnce(Native D/AndroidRuntime: Shutting down VM E/AndroidRuntime: FATAL EXCEPTION: main Process: mobile.socialboards.com, PID: 27289 java.lang.ClassCastException: java.lang.String cannot be cast to android.text.Spanned at com.tokenautocomplete.SpanUtils.ellipsizeWithSpans(SpanUtils.java:36) at com.tokenautocomplete.TokenCompleteTextView.performCollapse(TokenCompleteTextView.java:793) at com.tokenautocomplete.TokenCompleteTextView.onFocusChanged(TokenCompleteTextView.java:844) at android.view.View.clearFocusInternal(View.java:7164) at android.view.View.unFocus(View.java:7197) at android.view.ViewGroup.requestChildFocus(ViewGroup.java:813) at android.view.View.handleFocusGainInternal(View.java:6989) at android.view.View.requestFocusNoSearch(View.java:11642) at android.view.View.requestFocus(View.java:11616) at android.view.View.requestFocus(View.java:11583) at android.view.View.requestFocus(View.java:11525) at android.view.View.onTouchEvent(View.java:13909) at android.widget.TextView.onTouchEvent(TextView.java:10421) at com.tokenautocomplete.TokenCompleteTextView.onTouchEvent(TokenCompleteTextView.java:701) at android.view.View.dispatchTouchEvent(View.java:12615) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:541) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1893) at android.app.Dialog.dispatchTouchEvent(Dialog.java:1001) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:490) at android.view.View.dispatchPointerEvent(View.java:12860) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5767) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5533) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5040) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5006) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5160) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5014) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5217) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5040) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5006) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5014) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7794) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7759) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7717) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7986) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:202) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:386) at android.os.Looper.loop(Looper.java:169) at android.app.ActivityThread.main(ActivityThread.java:7470) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958) E/CustomActivityOnCrash: App has crashed, executing CustomActivityOnCrash's UncaughtExceptionHandler java.lang.ClassCastException: java.lang.String cannot be cast to android.text.Spanned at com.tokenautocomplete.SpanUtils.ellipsizeWithSpans(SpanUtils.java:36) at com.tokenautocomplete.TokenCompleteTextView.performCollapse(TokenCompleteTextView.java:793) at com.tokenautocomplete.TokenCompleteTextView.onFocusChanged(TokenCompleteTextView.java:844) at android.view.View.clearFocusInternal(View.java:7164) at android.view.View.unFocus(View.java:7197) at android.view.ViewGroup.requestChildFocus(ViewGroup.java:813) at android.view.View.handleFocusGainInternal(View.java:6989) at android.view.View.requestFocusNoSearch(View.java:11642) at android.view.View.requestFocus(View.java:11616) at android.view.View.requestFocus(View.java:11583) at android.view.View.requestFocus(View.java:11525) at android.view.View.onTouchEvent(View.java:13909) at android.widget.TextView.onTouchEvent(TextView.java:10421) at com.tokenautocomplete.TokenCompleteTextView.onTouchEvent(TokenCompleteTextView.java:701) at android.view.View.dispatchTouchEvent(View.java:12615) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:541) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1893) at android.app.Dialog.dispatchTouchEvent(Dialog.java:1001) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:490) at android.view.View.dispatchPointerEvent(View.java:12860) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5767) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5533) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5040) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5006) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5160) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5014) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5217) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5040) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5006) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5014) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4987) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7794) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7759) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7717) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7986) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:202) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:386) at android.os.Looper.loop(Looper.java:169) at android.app.ActivityThread.main(ActivityThread.java:7470) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)