问题描述
我在我的应用程序中从 CoordinatorLayout $中的
onLayout
函数崩溃(来自Crashlytics,无法在本地重现) c $ c>:
I'm getting a crash (from Crashlytics, unable to reproduce locally) in my app from the onLayout
function in the CoordinatorLayout
:
Fatal Exception: java.lang.IndexOutOfBoundsException: Invalid index 3, size is 3
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.ArrayList.get(ArrayList.java:308)
at android.support.design.widget.CoordinatorLayout.onLayout(SourceFile:848)
at android.view.View.layout(View.java:15237)
at android.view.ViewGroup.layout(ViewGroup.java:4864)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:515)
at android.widget.FrameLayout.onLayout(FrameLayout.java:450)
at android.view.View.layout(View.java:15237)
at android.view.ViewGroup.layout(ViewGroup.java:4864)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1888)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1742)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1651)
at android.view.View.layout(View.java:15237)
at android.view.ViewGroup.layout(ViewGroup.java:4864)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:515)
at android.widget.FrameLayout.onLayout(FrameLayout.java:450)
at android.view.View.layout(View.java:15237)
at android.view.ViewGroup.layout(ViewGroup.java:4864)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1888)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1742)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1651)
at android.view.View.layout(View.java:15237)
at android.view.ViewGroup.layout(ViewGroup.java:4864)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:515)
at android.widget.FrameLayout.onLayout(FrameLayout.java:450)
at android.view.View.layout(View.java:15237)
at android.view.ViewGroup.layout(ViewGroup.java:4864)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2323)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2029)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1192)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6231)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:816)
at android.view.Choreographer.doCallbacks(Choreographer.java:619)
at android.view.Choreographer.doFrame(Choreographer.java:588)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:802)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5388)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:655)
at dalvik.system.NativeStart.main(NativeStart.java)
由于我自己无法重现这个并且在CoordinatorLayouts中有6项活动,我该如何调试呢?
Since I haven't been able to reproduce this myself and have 6 activities with CoordinatorLayouts, how can I go about debugging this?
修改:看起来会在
推荐答案
我有类似的问题,并降级为较旧的Android支持库版本(v24.1.1)适用于我。这似乎是图书馆中的问题,您可以通过Android问题跟踪器检查问题。
I had a similar issue, and downgrading to a older Android Support Library version(v24.1.1) worked for me. It's seems to be a problem in the Library, you can check the problem out the Android Issue Tracker here.
UPDATE 1 :似乎它将在Android支持的下一个版本中得到解决图书馆(v24.2.1),感谢的更新
UPDATE 1 : Seems like it's going to be resolved in de next version of the Android Support Library(v24.2.1), thanks Daniel Rampelt for the update
UPDATE 2 :24.2.1从今天开始,错误似乎已经解决 - 至少我可以用当前版本重现它。 - PattaFeuFeu
UPDATE 2 : 24.2.1 is out as of today and the error seems to be resolved—at least I couldnae reproduce it with the current version. – PattaFeuFeu
更新3 :24.2.1引入了新的错误: - AAverin
UPDATE 3 : 24.2.1 introduced new bug: post – AAverin
这篇关于CoordinatorLayout使用IndexOutOfBoundsException崩溃应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!