如何调试仅涉及Android框架代码的崩溃?

时间:2018-06-14 02:30:45

标签: android android-debug

偶尔我会收到崩溃报告(在Firebase中),其中stacktrace仅包含Framework代码。例如:

Fatal Exception: java.lang.IndexOutOfBoundsException
setSpan (-1 ... -1) starts before 0
android.text.SpannableStringBuilder.checkRange (SpannableStringBuilder.java:1270)
android.text.SpannableStringBuilder.setSpan (SpannableStringBuilder.java:684)
android.text.SpannableStringBuilder.setSpan (SpannableStringBuilder.java:677)
android.text.Selection.setSelection (Selection.java:76)
android.text.method.ArrowKeyMovementMethod.onTouchEvent (ArrowKeyMovementMethod.java:284)
arrow_right
android.widget.TextView.onTouchEvent (TextView.java:10140)
android.view.View.dispatchTouchEvent (View.java:10920)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2842)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2527)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2842)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2527)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2842)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2527)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2842)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2527)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2842)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2527)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2842)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2527)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2842)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2527)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2842)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2527)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2842)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2527)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2842)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2527)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2842)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2527)
com.android.internal.policy.DecorView.superDispatchTouchEvent (DecorView.java:623)
com.android.internal.policy.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1909)
android.app.Activity.dispatchTouchEvent (Activity.java:3247)
android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent (SourceFile:68)
android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent (SourceFile:68)
com.android.internal.policy.DecorView.dispatchTouchEvent (DecorView.java:585)
android.view.View.dispatchPointerEvent (View.java:11149)
android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent (ViewRootImpl.java:5227)
android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:5076)
android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4580)
android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4633)
android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4599)
android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:4736)
android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4607)
android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:4793)
android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4580)
android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4633)
android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4599)
android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4607)
android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4580)
android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:7210)
android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:7142)
android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:7103)
android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:7321)
android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:185)
android.view.InputEventReceiver.nativeConsumeBatchedInputEvents (InputEventReceiver.java)
android.view.InputEventReceiver.consumeBatchedInputEvents (InputEventReceiver.java:176)
android.view.ViewRootImpl.doConsumeBatchedInput (ViewRootImpl.java:7284)
android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run (ViewRootImpl.java:7348)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:930)
android.view.Choreographer.doCallbacks (Choreographer.java:705)
android.view.Choreographer.doFrame (Choreographer.java:634)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:916)
android.os.Handler.handleCallback (Handler.java:751)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6816)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1563)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1451)

由于我的代码中没有元素,我无法捕获这样的异常,也无法获取任何有用的信息来记录。在这个特定的例子中,似乎没有办法找出我的代码中哪个TextView响应。

我唯一能想到的是用自定义TextView替换每个TextView(因此覆盖onTouchEvent()以捕获并报告异常),但是有很多TextView,那么还有另外一种方法吗? / p>

注意:我无法在自己的设备上重现此问题。

0 个答案:

没有答案