简体   繁体   English

重新启动后,应用程序引发错误

[英]Application throws an error after relaunch

My application throws an error when I attempt to start it from "Recent applications". 当我尝试从“最近的应用程序”启动它时,我的应用程序抛出错误。 Problems : 问题 :

  1. Error appears only if application was inactive (stopped) for a long time (approximately one hour). 仅当应用程序长时间(约一小时)处于非活动状态(停止)时,才会出现错误。 I can't catch this error by myself - when I'm killing process by myself and then relaunched it there is no errors! 我自己无法捕捉到此错误-当我自己杀死进程然后重新启动它时,没有错误!

  2. I can't see Exception log in debugger, since it's disconnects after so long time. 我看不到调试器中的异常日志,因为它在很长一段时间后会断开连接。

How can I catch such kind of errors in debugger? 如何在调试器中捕获此类错误? Looks error appears only when OS kills application by itself. 仅当OS自行终止应用程序时,才会出现Looks错误。

EDIT 编辑

I didn't overrided onResume method. 我没有重写onResume方法。 Just onStart , and there is nothing special except instantination of my SQLiteOpenHelper. 只是onStart ,除了实例化我的SQLiteOpenHelper之外没有什么特别的。

even if your app is in paused/stopped state, log cat will still be working as long as device is connected. 即使您的应用处于暂停/停止状态,只要连接了设备,log cat仍然可以正常工作。 make sure you selected all logs options in windows > devices > all logs instead of windows > devices > com.your.project . 确保在Windows>设备>所有日志而不是Windows>设备> com.your.project中选择了所有日志选项。 so when you will try to relaunch crash must be recorded in logCat 因此,当您尝试重新启动崩溃时,必须将其记录在logCat中

if still have any issue, install logcat app from market and refer it for logs. 如果仍然有任何问题,请从市场上安装logcat应用程序,并将其用于日志。

Sounds like there might be an issue in your 听起来可能是您的问题

OnResume 

call. 呼叫。 What is your application doing? 您的应用程序在做什么? Is it using a location manager? 是否使用位置管理器? Does it have services or threads that need to be restarted? 是否具有需要重新启动的服务或线程? More infomation please. 请获取更多信息。

Look through the Android application lifecycle chart: http://developer.android.com/reference/android/app/Activity.html 浏览Android应用程序生命周期图: http : //developer.android.com/reference/android/app/Activity.html

It should help you understand what's going on. 它应该可以帮助您了解发生了什么。 If all else fails, add a lot of logging to logcat and see what the output looks like on your end. 如果其他所有方法均失败,则将大量日志记录添加到logcat中,然后查看输出结果。 As long as you don't unplug the device, you shouldn't lose that in Eclipse. 只要您不拔出设备的电源,就不应在Eclipse中丢失它。 If you do, you can always run "adb logcat" from the command line or shell to see exactly what's happening. 如果这样做,则始终可以从命令行或shell运行“ adb logcat”以查看发生了什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM