如何分析程序在启动时崩溃时显示的此logcat错误?

时间:2013-09-23 08:55:18

标签: android logcat android-logcat

这是来自logcat:

09-23 17:48:00.288: E/AndroidRuntime(13056): FATAL EXCEPTION: main
09-23 17:48:00.288: E/AndroidRuntime(13056): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mybasicinteractivegraph/com.example.mybasicinteractivegraph.MainActivity}: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.SeekBar
09-23 17:48:00.288: E/AndroidRuntime(13056):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at android.os.Looper.loop(Looper.java:137)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at android.app.ActivityThread.main(ActivityThread.java:5103)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at java.lang.reflect.Method.invokeNative(Native Method)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at java.lang.reflect.Method.invoke(Method.java:525)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at dalvik.system.NativeStart.main(Native Method)
09-23 17:48:00.288: E/AndroidRuntime(13056): Caused by: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.SeekBar
09-23 17:48:00.288: E/AndroidRuntime(13056):    at com.example.mybasicinteractivegraph.MainActivity.onCreate(MainActivity.java:49)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at android.app.Activity.performCreate(Activity.java:5133)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-23 17:48:00.288: E/AndroidRuntime(13056):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-23 17:48:00.288: E/AndroidRuntime(13056):    ... 11 more  

我只发布了logcat中用红色编码的那些。我不知道为什么或如何发生这种情况。最糟糕的是,该程序正在编译并正常工作,但随后我在activity_main.xml的GUI版本上玩了一段时间,突然程序开始崩溃。我在onCreate()开头放置的Log.d()代码似乎在logcat中显示了它们的错误消息,所以我知道程序至少在这一点上运行。但是之后为什么会崩溃呢?这个logcat错误是什么意思?

0 个答案:

没有答案