apk安装失败& logcat 显示 NoSuchMethodException

发布于 2025-01-07 17:19:43 字数 2337 浏览 1 评论 0原文

正如标题中提到的,编译时,控制台显示: Failed to install ap.apk

但 logcat 显示:

    02-21 00:45:25.052: W/dalvikvm(921): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
    02-21 00:45:25.272: E/AndroidRuntime(921): FATAL EXCEPTION: main
    02-21 00:45:25.272: E/AndroidRuntime(921): java.lang.IllegalStateException: Could not find a method retour(View) in the activity class hd.android.contact.ContactActionActivity for onClick handler on view class android.widget.Button with id 'button5'
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.view.View$1.onClick(View.java:3031)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.view.View.performClick(View.java:3511)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.view.View$PerformClick.run(View.java:14105)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.os.Handler.handleCallback(Handler.java:605)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.os.Handler.dispatchMessage(Handler.java:92)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.os.Looper.loop(Looper.java:137)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.app.ActivityThread.main(ActivityThread.java:4424)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at java.lang.reflect.Method.invokeNative(Native Method)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at java.lang.reflect.Method.invoke(Method.java:511)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at dalvik.system.NativeStart.main(Native Method)
    **02-21 00:45:25.272: E/AndroidRuntime(921): Caused by: java.lang.NoSuchMethodException: retour [class android.view.View]**
    02-21 00:45:25.272: E/AndroidRuntime(921):  at java.lang.Class.getConstructorOrMethod(Class.java:460)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at java.lang.Class.getMethod(Class.java:915)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.view.View$1.onClick(View.java:3024)

我注释了所有“retour”方法并删除了所有 android:onClick< /em> 与此方法相关,但它没有帮助...之前一切正常...

有人可以帮忙吗?

先感谢您

As mentioned in the title, when compiling, the Console says: Failed to install ap.apk

But the logcat shows this:

    02-21 00:45:25.052: W/dalvikvm(921): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
    02-21 00:45:25.272: E/AndroidRuntime(921): FATAL EXCEPTION: main
    02-21 00:45:25.272: E/AndroidRuntime(921): java.lang.IllegalStateException: Could not find a method retour(View) in the activity class hd.android.contact.ContactActionActivity for onClick handler on view class android.widget.Button with id 'button5'
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.view.View$1.onClick(View.java:3031)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.view.View.performClick(View.java:3511)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.view.View$PerformClick.run(View.java:14105)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.os.Handler.handleCallback(Handler.java:605)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.os.Handler.dispatchMessage(Handler.java:92)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.os.Looper.loop(Looper.java:137)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.app.ActivityThread.main(ActivityThread.java:4424)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at java.lang.reflect.Method.invokeNative(Native Method)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at java.lang.reflect.Method.invoke(Method.java:511)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at dalvik.system.NativeStart.main(Native Method)
    **02-21 00:45:25.272: E/AndroidRuntime(921): Caused by: java.lang.NoSuchMethodException: retour [class android.view.View]**
    02-21 00:45:25.272: E/AndroidRuntime(921):  at java.lang.Class.getConstructorOrMethod(Class.java:460)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at java.lang.Class.getMethod(Class.java:915)
    02-21 00:45:25.272: E/AndroidRuntime(921):  at android.view.View$1.onClick(View.java:3024)

I commented all my "retour" methods and deleted all android:onClick related to this method, and it did not help...Everything was working fine before...

Can anybody help please?

Thank you in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萝莉病 2025-01-14 17:19:43
IllegalStateException: Could not find a method retour(View)

我认为问题在于您(肯定)在 XML 中的方法 retour 上指定了 onClick 但该方法
Java 代码中不存在。

如果问题仍然存在,请尝试清理项目并关闭您的软件电话。

IllegalStateException: Could not find a method retour(View)

I think the problem is that you (definitely) have specified onClick on a method retour in the XML but the method
is not present in the Java code.

If the problem continues, try cleaning the project and shutting down your softphone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文