在执行应用程序时,我遇到了这种类型的错误。
我的代码在支持库24.2.0(在Linux操作系统中的Android Studio)中工作,当我在Windows操作系统中运行此代码时,出现了一些错误,为了解决这个问题,我将支持库升级到了25.0.0并解决了问题,但是现在会生成以下所述的错误。
compileSdkVersion = 25
buildToolsVersion = '25.0.0'
supportLibraryVersion = '25.0.0'
targetSdkVersion = 25
E/UncaughtException: java.lang.NoSuchMethodError: No static method isCtrlPressed(Landroid/view/KeyEvent;)Z in class Landroid/support/v4/view/KeyEventCompatHoneycomb; or its super classes (declaration of 'android.support.v4.view.KeyEventCompatHoneycomb' appears in /data/app/com.xxx/base.apk:classes23.dex)
at android.support.v4.view.KeyEventCompat$HoneycombKeyEventVersionImpl.isCtrlPressed(KeyEventCompat.java:120)
at android.support.v4.view.KeyEventCompat.isCtrlPressed(KeyEventCompat.java:197)
at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:532)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:57)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:315)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2310)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4127)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4089)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3642)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3695)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3661)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3787)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3669)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3844)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3642)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3695)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3661)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3669)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3642)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5922)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5896)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5857)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3434)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)`