Android

时间:2017-03-07 07:11:24

标签: android

昨天我将我的Android工作室从2.2.3升级到2.3 然后得到一个错误

  

错误:SDK Build Tools修订版(24.0.2)对于项目':app'来说太低了。最低要求是25.0.0“

当我尝试构建我的项目时。

所以,我将项目gradle文件更改为

compileSdkVersion 25
buildToolsVersion "25.0.0"
targetSdkVersion 25

compile 'com.android.support:appcompat-v7:25.0.1'

似乎一切正常,我已经成功运行了我的APP 但是当我点按手机上的按钮时 APP崩溃了。

另外,我引用了这篇文章java.lang.NoSuchMethodError: No static method isCtrlPressed(Landroid/view/KeyEvent;)

03-07 15:04:32.375 7133-7133/com.youhong.cuptime.cuptime E/InputEventSender: Exception dispatching finished signal.
03-07 15:04:32.375 7133-7133/com.youhong.cuptime.cuptime E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
03-07 15:04:32.385 7133-7133/com.youhong.cuptime.cuptime E/MessageQueue-JNI: java.lang.NoSuchMethodError: No static method isCtrlPressed(Landroid/view/KeyEvent;)Z in class Landroid/support/v4/view/KeyEventCompat; or its super classes (declaration of 'android.support.v4.view.KeyEventCompat' appears in /data/app/com.youhong.cuptime.cuptime-2/split_lib_dependencies_apk.apk)
                                                                                 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:2682)
                                                                                 at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:5273)
                                                                                 at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5226)
                                                                                 at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4673)
                                                                                 at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4726)
                                                                                 at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4692)
                                                                                 at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4834)
                                                                                 at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4700)
                                                                                 at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4891)
                                                                                 at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4673)
                                                                                 at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4726)
                                                                                 at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4692)
                                                                                 at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4700)
                                                                                 at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4673)
                                                                                 at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4726)
                                                                                 at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4692)
                                                                                 at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4867)
                                                                                 at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:5110)
                                                                                 at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2877)
                                                                                 at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2449)
                                                                                 at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2440)
                                                                                 at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2854)
                                                                                 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:143)
                                                                                 at android.app.ActivityThread.main(ActivityThread.java:7225)
                                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
03-07 15:04:32.385 7133-7133/com.youhong.cuptime.cuptime E/AndroidRuntime: FATAL EXCEPTION: main
                                                                           Process: com.youhong.cuptime.cuptime, PID: 7133
                                                                           java.lang.NoSuchMethodError: No static method isCtrlPressed(Landroid/view/KeyEvent;)Z in class Landroid/support/v4/view/KeyEventCompat; or its super classes (declaration of 'android.support.v4.view.KeyEventCompat' appears in /data/app/com.youhong.cuptime.cuptime-2/split_lib_dependencies_apk.apk)
                                                                               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:2682)
                                                                               at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:5273)
                                                                               at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5226)
                                                                               at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4673)
                                                                               at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4726)
                                                                               at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4692)
                                                                               at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4834)
                                                                               at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4700)
                                                                               at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4891)
                                                                               at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4673)
                                                                               at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4726)
                                                                               at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4692)
                                                                               at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4700)
                                                                               at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4673)
                                                                               at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4726)
                                                                               at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4692)
                                                                               at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4867)
                                                                               at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:5110)
                                                                               at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2877)
                                                                               at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2449)
                                                                               at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2440)
                                                                               at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2854)
                                                                               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:143)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:7225)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
  

03-07 15:57:04.595 12048-12054 /? E / art:向调试器发送回复失败:管道损坏   03-07 15:58:07.620 12048-12048 / com.youhong.cuptime.cuptime E / AndroidRuntime:FATAL EXCEPTION:main                                                                                过程:com.youhong.cuptime.cuptime,PID:12048                                                                                java.lang.VerifyError:Verifier拒绝了类com.youhong.cuptime.cuptime.PersonalHomepage.PersonalHomePageActivity由于方法错误java.lang.Object com.youhong.cuptime.cuptime.PersonalHomepage.PersonalHomePageActivity.access $ super(com.youhong.cuptime .cuptime.PersonalHomepage.PersonalHomePageActivity,java.lang.String,java.lang.Object [])('com.youhong.cuptime.cuptime.PersonalHomepage.PersonalHomePageActivity'的声明出现在/data/app/com.youhong.cuptime中。 cuptime-2 / split_lib_slice_4_apk.apk)                                                                                    at java.lang.Class.newInstance(Native Method)                                                                                    在android.app.Instrumentation.newActivity(Instrumentation.java:1067)                                                                                    在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)                                                                                    在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)                                                                                    在android.app.ActivityThread.-wrap11(ActivityThread.java)                                                                                    在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1344)                                                                                    在android.os.Handler.dispatchMessage(Handler.java:102)                                                                                    在android.os.Looper.loop(Looper.java:148)                                                                                    在android.app.ActivityThread.main(ActivityThread.java:5417)                                                                                    at java.lang.reflect.Method.invoke(Native Method)                                                                                    在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:726)                                                                                    在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

1 个答案:

答案 0 :(得分:0)

当子类化AppCompatActivity时,在点击硬件后退按钮时会导致OP问题。解决方法是将Activity类子类化。