如标题中所述,在编译时,控制台会说: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 ,它没有帮助...一切正常之前......
有人可以帮忙吗?
提前谢谢
答案 0 :(得分:2)
IllegalStateException: Could not find a method retour(View)
我认为问题是你(肯定)已经在XML中的方法onClick
上指定了retour
但是方法
在Java代码中不存在。
如果问题仍然存在,请尝试清洁项目并关闭软电话。