Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoSuchMethodError: No static method dispatch Unhandled KeyEvent Pre

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

like image 264
Sunny Avatar asked Jan 03 '23 04:01

Sunny


2 Answers

check you are using 1.0.0-beta01 version of appcompat library

like image 107
Melvin Kent Avatar answered Feb 10 '23 22:02

Melvin Kent


For me, going to the gradle.build file and making sure that all the dependencies are up-to-date (new versions) fixed this problem.

like image 22
Haider Ali J Al-Rustem Avatar answered Feb 10 '23 22:02

Haider Ali J Al-Rustem