在Android Studio中增加Debug(logcat?)大小

时间:2017-12-31 11:16:18

标签: java android android-studio debugging logcat

我有这个java.lang.IndexOutOfBoundsException问题,我想在我的代码中跟踪它,但是Android Studio没有给我足够的Back Stack(Debug和Logcat选项卡)来查看问题的开始位置。我想增加显示的调试信息的大小,但我不知道该怎么做。

我已经尝试过这里显示的两种方法:Android Studio logcat history/buffer size但它们似乎无法正常工作,我总是得到相同的调试信息。

 --------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.zboot.alarm1, PID: 3011
                  java.lang.IndexOutOfBoundsException: Invalid index 7, size is 7
                      at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
                      at java.util.ArrayList.get(ArrayList.java:308)
                      at com.bignerdranch.expandablerecyclerview.Adapter.ExpandableRecyclerAdapter.getItemViewType(ExpandableRecyclerAdapter.java:233)
                      at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5631)
                      at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5563)
                      at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5559)
                      at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2229)
                      at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1556)
                      at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1516)
                      at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:608)
                      at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3693)
                      at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3109)
                      at android.view.View.measure(View.java:18788)
                      at android.support.constraint.ConstraintLayout.internalMeasureChildren(ConstraintLayout.java:934)
                      at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:973)
                      at android.view.View.measure(View.java:18788)
                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                      at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:714)
                      at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:786)
                      at android.view.View.measure(View.java:18788)
                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                      at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
                      at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
                      at android.view.View.measure(View.java:18788)
                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                      at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
                      at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
                      at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
                      at android.view.View.measure(View.java:18788)
                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                      at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
                      at android.view.View.measure(View.java:18788)
                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                      at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
                      at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
                      at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
                      at android.view.View.measure(View.java:18788)
                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                      at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
                      at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2643)
                      at android.view.View.measure(View.java:18788)
                      at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2100)
                      at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1216)
                      at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1452)
                      at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
                      at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
                      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
                      at android.view.Choreographer.doCallbacks(Choreographer.java:670)
                      at android.view.Choreographer.doFrame(Choreographer.java:606)
                      at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
                      at android.os.Handler.handleCallback(Handler.java:739)
                      at android.os.Handler.dispatchMessage(Handler.java:95)
                      at android.os.Looper.loop(Looper.java:148)
                      at android.app.ActivityThread.main(ActivityThread.java:5417)
                    at j

1 个答案:

答案 0 :(得分:0)

不是您要求的确切解决方案,而是获得异常跟踪的最佳方法之一。

您应该使用以下命令记录Crashlytics上的所有例外情况:

Crashlytics.logException(e);

所有记录的异常都将报告为非致命错误。