When migrating to androidx I am getting above error when back pressing.
java.lang.NoSuchMethodError: No static method dispatchUnhandledKeyEventPre(Landroid/view/View;Landroid/view/KeyEvent;)Z in class Landroidx/core/view/ViewCompat; or its super classes (declaration of 'androidx.core.view.ViewCompat' appears in 1/split_lib_dependencies_apk.apk)
at androidx.appcompat.app.AppCompatDelegateImpl.dispatchKeyEvent(AppCompatDelegateImpl.java:1162)
at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:2529)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:59)
at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:329)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4792)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4759)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4082)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4135)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4101)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4109)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4082)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4135)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4101)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4257)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4109)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4314)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4082)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4135)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4101)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4109)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4082)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4135)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4101)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4290)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4451)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2434)
at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1998)
at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1989)
at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2411)
at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:6351)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:896)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:786)
I think in ViewCompat class does not have dispatchUnhandledKeyEventPre
method. I am using some third party dependency so I don't know which method causing it
check you are using 1.0.0-beta01 version of appcompat library
For me, going to the gradle.build file and making sure that all the dependencies are up-to-date (new versions) fixed this problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With