问题描述
在执行App时出现此类错误.
I got this type of error while executing App.
我的代码在支持库24.2.0(Linux操作系统中的Android Studio)中工作,当我在Windows操作系统中运行此代码时,出现了一些错误,对于该解决方案,我将支持库升级到25.0.0,解决,但现在出现下面提到的错误.
My code is work in support library 24.2.0 (Android studio in Linux operating system) and when I run this code in windows operating system I got some error, for that solution I upgrade my support library to 25.0.0 and it resolve but now below mentioned error generated.
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)`
推荐答案
我解决了此问题.确保您的buildToolVersion,CompileSdkVersion和targetSdkVersion与您的支持库匹配.
I resolved This Issue.Make sure your buildToolVersion, CompileSdkVersion and targetSdkVersion match with your support library.
在以下配置中,我收到了错误消息,
In below configuration I got error,
compileSdkVersion = 24
buildToolsVersion = '24.0.2'
targetSdkVersion = 24
supportLibraryVersion = '24.2.0'
所以,我更新到了
compileSdkVersion = 25
buildToolsVersion = '25.0.0'
targetSdkVersion = 25
supportLibraryVersion = '25.0.1'
这解决了我的问题.确保它必须与主要发行版本匹配.
and that's resolved my issue. Make sure it must match with Major release version.
这篇关于java.lang.NoSuchMethodError:类Landroid/support/v4/view/KeyEventCompatHoneycomb中没有静态方法isCtrlPressed(Landroid/view/KeyEvent;)Z的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!