I'm getting UnsupportedOperationException crash on live app. All the crashes are associated with Moto Android 11 devices. Can see that it's somehow related to onKeyUp. But still no clue how to reproduce or fix this. Any help would be appreciated.
Fatal Exception: java.lang.UnsupportedOperationException: Tried to obtain display from a Context not associated with one. Only visual Contexts (such as Activity or one created with Context#createWindowContext) or ones created with Context#createDisplayContext are associated with displays. Other types of Contexts are typically related to background entities and may return an arbitrary display.
at android.app.ContextImpl.getDisplay(ContextImpl.java:2580)
at android.content.ContextWrapper.getDisplay(ContextWrapper.java:1030)
at android.content.ContextWrapper.getDisplay(ContextWrapper.java:1030)
at android.app.Activity.onKeyUp(Activity.java:3859)
at android.view.KeyEvent.dispatch(KeyEvent.java:2866)
at android.app.Activity.dispatchKeyEvent(Activity.java:4176)
at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:122)
at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:84)
at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:140)
at androidx.appcompat.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:558)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:59)
at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:2814)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:59)
at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:418)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:6101)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5969)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5464)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5521)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5487)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5639)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5495)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5696)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5468)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5521)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5487)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5495)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5468)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8313)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8229)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:8190)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:5219)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7766)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
Context
is havinggetDisplay()
called on it? – BoylesContext
orActivity
this is being called on, you won't be able to get very far. – Boyles