迁移到 androidx 时,我在返回时遇到错误。
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)
我认为在 ViewCompat 类中没有dispatchUnhandledKeyEventPre
方法。我正在使用一些第三方依赖项,所以我不知道是哪种方法导致它