如何找出导致 Android 应用程序崩溃的错误?
我正在创建一个向 XML 站点发出 http 请求的应用程序。然后我使用 DOM 从 XML 获取信息。问题是,当我尝试在 Android 模拟器中运行该应用程序时,该应用程序崩溃了,但当我将它作为 java 应用程序运行时,它运行良好。我如何找出导致我的 Android 应用程序崩溃的错误?我已启用使用互联网的权限。
我认为这是来自 LogCat 的错误:
11-15 11:57:37.618: WARN/dalvikvm(280): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): FATAL EXCEPTION: main
11-15 11:57:37.639: ERROR/AndroidRuntime(280): android.app.SuperNotCalledException: Activity {xml.android.test/xml.android.test.AndroidXMLActivity} did not call through to super.onCreate()
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2629)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.os.Handler.dispatchMessage(Handler.java:99)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.os.Looper.loop(Looper.java:123)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at java.lang.reflect.Method.invokeNative(Native Method)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at java.lang.reflect.Method.invoke(Method.java:521)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at dalvik.system.NativeStart.main(Native Method)
11-15 11:57:37.702: WARN/ActivityManager(59): Force finishing activity xml.android.test/.AndroidXMLActivity
11-15 11:57:38.220: WARN/ActivityManager(59): Activity pause timeout for HistoryRecord{44ed8770 xml.android.test/.AndroidXMLActivity}
11-15 11:57:38.228: INFO/ActivityManager(59): Displayed activity com.android.launcher/com.android.launcher2.Launcher: 27460 ms (total 27460 ms)
11-15 11:57:48.303: WARN/ActivityManager(59): Activity destroy timeout for HistoryRecord{44ed8770 xml.android.test/.AndroidXMLActivity}
I'm creating an application that's making a http request to a XML site. I'm then using DOM to get the information from XML. Problem is that the app is crashing when i try to run it in android emulator but it works perfectly when i run it as an java app. How can i find out what error is causing my android application to crash? I've enabled the permission to use internet.
I think this is the error from LogCat im getting:
11-15 11:57:37.618: WARN/dalvikvm(280): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): FATAL EXCEPTION: main
11-15 11:57:37.639: ERROR/AndroidRuntime(280): android.app.SuperNotCalledException: Activity {xml.android.test/xml.android.test.AndroidXMLActivity} did not call through to super.onCreate()
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2629)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.os.Handler.dispatchMessage(Handler.java:99)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.os.Looper.loop(Looper.java:123)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at java.lang.reflect.Method.invokeNative(Native Method)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at java.lang.reflect.Method.invoke(Method.java:521)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-15 11:57:37.639: ERROR/AndroidRuntime(280): at dalvik.system.NativeStart.main(Native Method)
11-15 11:57:37.702: WARN/ActivityManager(59): Force finishing activity xml.android.test/.AndroidXMLActivity
11-15 11:57:38.220: WARN/ActivityManager(59): Activity pause timeout for HistoryRecord{44ed8770 xml.android.test/.AndroidXMLActivity}
11-15 11:57:38.228: INFO/ActivityManager(59): Displayed activity com.android.launcher/com.android.launcher2.Launcher: 27460 ms (total 27460 ms)
11-15 11:57:48.303: WARN/ActivityManager(59): Activity destroy timeout for HistoryRecord{44ed8770 xml.android.test/.AndroidXMLActivity}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用 logcat 检查模拟器日志中的崩溃消息。如果该消息解释了您的问题,请修复它。如果没有将消息添加到您的帖子中,也许我们能够帮助您。
Use logcat to check the emulator log for the crash message. If the message explains your problem fix it. If not add the message to your post and maybe we will be able to help you.
您可以使用 LogCat 来获取崩溃原因。它在Eclipse中可用,最左角有一个按钮,单击该按钮可以看到Logcat的选项。当您启动应用程序时,它会显示所有日志。当应用程序崩溃时,它将显示到崩溃的行级别。
You can use LogCat for getting the reason of crash. it is available in the Eclipse, very left corner there is button and by clicking that you can see the option of the Logcat. when you launch the application it will show you all the logs. and when application crashes it will show upto the line level of crash.
这是您的问题:
这意味着您的活动
onCreate
方法应该调用super.onCreate()
(作为其第一行)。This is your problem:
It means your activity
onCreate
method should callsuper.onCreate()
(as its first line).您可以使用运行应用程序时发现的 logcat,并且可以根据要显示的消息类型放置 Log.e 或 iv。这样您就可以检测到确切的错误以及应用程序崩溃的位置。
You can use logcat which you will find running your applications, and you can put
Log.e
or i v depending on what type of message you want to display. This way you can detect the exact error and where the application crashes.