在强制关闭的活动将重新启动 [英] Activity restarts on Force Close

查看:169
本文介绍了在强制关闭的活动将重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个根活动的应用程序。我最近有它引起了我的注意,我的活动结果的任何一种强制关闭在它重新启动,我不知道为什么会发生。如果我强迫未捕获的异常或使用'长回preSS强制关闭选项,它们都产生相同的。

I have an Application with a single root Activity. I've recently had it brought to my attention that any kind of Force Close on my Activity results in it restarting and I have no idea why this might happen. If I force an uncaught exception or use the 'long back press to force close' option, they both result in the same.

我唯一的猜测就一直与保留提到了活动的某些部分某种形式的怪癖,只有我没有在应用程序级别有一定的WeakReference项的任何外部。

My only guess would have been some form of quirk relating to retained references to some part of the Activity, only I don't have any outside of some WeakReference entries at the Application level.

相关logcat的条目:

Relevant logcat entries:

05-25 08:25:49.137: INFO/ActivityManager(18449): Displayed uk.co.randomicon.rstb/.TreeBuilderActivity: +8s82ms
05-25 08:25:54.222: DEBUG/dalvikvm(18546): GC_EXPLICIT freed 12K, 57% free 3640K/8327K, external 8323K/10136K, paused 72ms
05-25 08:25:55.373: WARN/InputManagerService(18449): Got RemoteException sending setActive(false) notification to pid 19122 uid 10069
05-25 08:25:59.217: DEBUG/dalvikvm(18646): GC_EXPLICIT freed 128K, 48% free 2980K/5703K, external 0K/0K, paused 67ms
05-25 08:26:00.238: DEBUG/dalvikvm(18991): GC_CONCURRENT freed 343K, 51% free 2794K/5639K, external 303K/532K, paused 3ms+3ms
05-25 08:26:02.950: INFO/Process(18449): Sending signal. PID: 19554 SIG: 9
05-25 08:26:02.980: INFO/ActivityManager(18449): Process uk.co.randomicon.rstb (pid 19554) has died.
05-25 08:26:02.990: ERROR/InputDispatcher(18449): channel '40a16ec8 uk.co.randomicon.rstb/uk.co.randomicon.rstb.TreeBuilderActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
05-25 08:26:02.990: ERROR/InputDispatcher(18449): channel '40a16ec8 uk.co.randomicon.rstb/uk.co.randomicon.rstb.TreeBuilderActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
05-25 08:26:02.990: INFO/WindowManager(18449): WINDOW DIED Window{40a16ec8 uk.co.randomicon.rstb/uk.co.randomicon.rstb.TreeBuilderActivity paused=false}
05-25 08:26:03.010: WARN/WindowManager(18449): Failed looking up window
05-25 08:26:03.010: WARN/WindowManager(18449): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@40c774e0 does not exist
05-25 08:26:03.010: WARN/WindowManager(18449):     at com.android.server.WindowManagerService.windowForClientLocked(WindowManagerService.java:8177)
05-25 08:26:03.010: WARN/WindowManager(18449):     at com.android.server.WindowManagerService.windowForClientLocked(WindowManagerService.java:8168)
05-25 08:26:03.010: WARN/WindowManager(18449):     at com.android.server.WindowManagerService$WindowState$DeathRecipient.binderDied(WindowManagerService.java:7026)
05-25 08:26:03.010: WARN/WindowManager(18449):     at android.os.BinderProxy.sendDeathNotice(Binder.java:385)
05-25 08:26:03.010: WARN/WindowManager(18449):     at dalvik.system.NativeStart.run(Native Method)
05-25 08:26:03.010: INFO/WindowManager(18449): WIN DEATH: null
05-25 08:26:03.020: INFO/ActivityManager(18449): Start proc uk.co.randomicon.rstb for activity uk.co.randomicon.rstb/.TreeBuilderActivity: pid=19565 uid=10069 gids={1015}

任何想法从哪里甚至开始乱抓将受到欢迎!

Any ideas where to even begin poking would be gratefully received!

编辑:这是由我的设置引起的安卓stateNotNeeded =真正的的在我的清单。虽然我并不需要的状态,这导致Android的决定是最好重新启动我的应用程序,假定用户希望的。

This was caused by me setting android:stateNotNeeded="true" in my Manifest. While I don't need the state, this caused Android to decide it was best to relaunch my app on the assumption the user would want that.

推荐答案

<一个href="http://groups.google.com/group/android-developers/browse_thread/thread/faa38d8678873a53#">Here一些有用的信息:

至于活动重新启动时 - 如果进程运行   前台活动消失,系统将扔掉的活动,如果   它并没有为它(通常这意味着它暂停的有效保存状态   并给出了系统的onSaveInstanceState从之前的结果   暂停)。一旦它已决定是否要扔掉该活动,它   将恢复的任何活动,现在是在堆栈的顶部。如果这是   你的活动之一 - 要么是因为你有另外的后面一个   坠毁,或一个坠毁在某种程度上它的入驻暂停状态    - 然后再重新启动过程中显示,顶级的活动

As far as when an activity is restarted -- if the process running the foreground activity goes away, the system will throw away that activity if it does not have a valid saved state for it (typically meaning it is paused and has given the system the result of onSaveInstanceState from before the pause). Once it has decided whether or not to throw away that activity, it will resume whatever activity is now at the top of the stack. If this is one of your activities -- either because you have another behind the one that crashed, or the one that crashed was somehow it the settled pause state -- then it will start your process again to show that top activity.

这篇关于在强制关闭的活动将重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆