6

当我在我的 Galaxy Nexus 上切换到 4.2 并继续使用我的 Nexus 4 时,这种情况开始发生。我的应用程序随机崩溃(软重置)设备,即使没有用户输入。

这是崩溃前的 Logcat:

01-17 12:54:24.960: E/AccessibilityManager(10497): Error during sending EventType: TYPE_WINDOW_CONTENT_CHANGED; EventTime: 151405384; PackageName: com.ntasher.homeconII; MovementGranularity: 0; Action: 0 [ ClassName: android.widget.FrameLayout; Text: []; ContentDescription: null; ItemCount: -1; CurrentItemIndex: -1; IsEnabled: true; IsPassword: false; IsChecked: false; IsFullScreen: false; Scrollable: false; BeforeText: null; FromIndex: -1; ToIndex: -1; ScrollX: -1; ScrollY: -1; MaxScrollX: -1; MaxScrollY: -1; AddedCount: -1; RemovedCount: -1; ParcelableData: null ]; recordCount: 0 
01-17 12:54:24.960: E/AccessibilityManager(10497): android.os.DeadObjectException
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.os.BinderProxy.transact(Native Method)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.accessibility.IAccessibilityManager$Stub$Proxy.sendAccessibilityEvent(IAccessibilityManager.java:227)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.accessibility.AccessibilityManager.sendAccessibilityEvent(AccessibilityManager.java:265)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.ViewRootImpl.requestSendAccessibilityEvent(ViewRootImpl.java:4700)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:4699)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.View.sendAccessibilityEventUnchecked(View.java:4680)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.View.sendAccessibilityEventInternal(View.java:4657)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.View.sendAccessibilityEvent(View.java:4626)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at com.android.internal.policy.impl.PhoneWindow$DecorView.sendAccessibilityEvent(PhoneWindow.java:2067)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.view.ViewRootImpl$SendWindowContentChangedAccessibilityEvent.run(ViewRootImpl.java:5462)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.os.Handler.handleCallback(Handler.java:725)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.os.Handler.dispatchMessage(Handler.java:92)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.os.Looper.loop(Looper.java:137)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at android.app.ActivityThread.main(ActivityThread.java:5039)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at java.lang.reflect.Method.invokeNative(Native Method)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at java.lang.reflect.Method.invoke(Method.java:511)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-17 12:54:24.960: E/AccessibilityManager(10497):  at dalvik.system.NativeStart.main(Native Method)
01-17 12:54:25.931: E/InputEventReceiver(10497): channel '42466698 com.ntasher.homeconII/com.ntasher.homeconII.HomeConII (client)' ~ Publisher closed input channel or an error occurred.  events=0x9

之后,设备软重置(直接到发光的“X”)。

这里发生了什么事?这是一些未处理的异常吗?我怎么能抓住它?谢谢。

4

1 回答 1

2

您没有提供任何代码,但我怀疑这是这里的问题。

Activity在创建一些绑定到系统的对象时,您正在传递一个上下文。因此,当您关闭应用程序并且对象保留时,它会变成死引用。对不再存在且不可见的 Activity 的引用。

在某些地方,您将有如下行:

SomeClass object = new SomeClass(this); //Or getActivity() or something.

在这里,将Context参数更改为getApplicationContext()(除非该代码正在创建并显示一个对话框,在这种情况下让 Activity 上下文为)。

于 2013-01-17T11:25:54.717 回答