https://kotlinlang.org logo
#compose
Title
# compose
r

Ravi

06/16/2022, 8:07 AM
Hi, we are observing crash in devices that have free ram less than 1gb. Its basically fb news feed with different types of compose views and normal viewholders inside recyclerview, we are unable to replicate the issue but firebase logs are popping up alot, stacktrace in the 🧵
Copy code
Fatal Exception: java.lang.IndexOutOfBoundsException: Index 10, size 0
       at androidx.compose.foundation.lazy.layout.IntervalListKt.intervalIndexForItemIndex(IntervalList.kt:61)
       at androidx.compose.foundation.lazy.layout.IntervalListKt.intervalForIndex(IntervalList.kt:57)
       at androidx.compose.foundation.lazy.LazyListItemsSnapshot.getIntervalForIndex(LazyListItemProviderImpl.kt:84)
       at androidx.compose.foundation.lazy.LazyListItemsSnapshot.getKey(LazyListItemProviderImpl.kt:89)
       at androidx.compose.foundation.lazy.LazyListItemProviderImpl.getKey(LazyListItemProviderImpl.kt:122)
       at androidx.compose.foundation.lazy.LazyMeasuredItemProvider.getAndMeasure-ZjPyQlc(LazyMeasuredItemProvider.kt:46)
       at androidx.compose.foundation.lazy.LazyListMeasureKt.measureLazyList-h7qLTbU(LazyListMeasure.kt:151)
       at androidx.compose.foundation.lazy.LazyListKt$rememberLazyListMeasurePolicy$1$1.invoke-0kLqBqw(LazyList.kt:266)
       at androidx.compose.foundation.lazy.LazyListKt$rememberLazyListMeasurePolicy$1$1.invoke(LazyList.kt:193)
       at androidx.compose.foundation.lazy.layout.LazyLayoutKt$LazyLayout$2$1.invoke-0kLqBqw(LazyLayout.kt:74)
       at androidx.compose.foundation.lazy.layout.LazyLayoutKt$LazyLayout$2$1.invoke(LazyLayout.kt:70)
       at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(SubcomposeLayout.kt:590)
       at androidx.compose.ui.node.InnerPlaceable.measure-BRTryo0(InnerPlaceable.kt:44)
       at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt:405)
       at androidx.compose.ui.node.ModifiedLayoutNode.measure-BRTryo0(ModifiedLayoutNode.kt:53)
       at androidx.compose.ui.node.LayoutNode$performMeasure$1.invoke(LayoutNode.kt:1420)
       at androidx.compose.ui.node.LayoutNode$performMeasure$1.invoke(LayoutNode.kt:1419)
       at androidx.compose.runtime.snapshots.Snapshot.enter(Snapshot.java:123)
       at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2098)
       at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:112)
       at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:78)
       at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:66)
       at androidx.compose.ui.node.LayoutNode.performMeasure-BRTryo0$ui_release(LayoutNode.kt:1419)
       at androidx.compose.ui.node.OuterMeasurablePlaceable.remeasure-BRTryo0(OuterMeasurablePlaceable.kt:94)
       at androidx.compose.ui.node.LayoutNode.remeasure-_Sx5XlM$ui_release(LayoutNode.kt:1373)
       at androidx.compose.ui.node.LayoutNode.remeasure-_Sx5XlM$ui_release$default(LayoutNode.kt:1364)
       at androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure-sdFAvZA(MeasureAndLayoutDelegate.kt:187)
       at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureAndRelayoutIfNeeded(MeasureAndLayoutDelegate.kt:274)
       at androidx.compose.ui.node.MeasureAndLayoutDelegate.access$getRoot$p(MeasureAndLayoutDelegate.kt:38)
       at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureAndLayout(MeasureAndLayoutDelegate.kt:208)
       at androidx.compose.ui.platform.AndroidComposeView.onMeasure(AndroidComposeView.android.kt:789)
       at android.view.View.measure(View.java:22251)
       at androidx.compose.ui.platform.AbstractComposeView.internalOnMeasure$ui_release(ComposeView.android.kt:298)
       at androidx.compose.ui.platform.AbstractComposeView.onMeasure(ComposeView.android.kt:285)
       at android.view.View.measure(View.java:22251)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6767)
       at androidx.coordinatorlayout.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:760)
       at com.google.android.material.appbar.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:99)
       at androidx.coordinatorlayout.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:831)
       at android.view.View.measure(View.java:22251)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6767)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.view.View.measure(View.java:22251)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6767)
       at androidx.coordinatorlayout.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:760)
       at com.google.android.material.appbar.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:99)
       at androidx.coordinatorlayout.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:831)
       at android.view.View.measure(View.java:22251)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6767)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145)
       at android.view.View.measure(View.java:22251)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6767)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
       at android.view.View.measure(View.java:22251)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6767)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.view.View.measure(View.java:22251)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6767)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
       at android.view.View.measure(View.java:22251)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6767)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at com.android.internal.policy.DecorView.onMeasure(DecorView.java:898)
       at android.view.View.measure(View.java:22251)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2500)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1564)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1826)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1446)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6954)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:925)
       at android.view.Choreographer.doCallbacks(Choreographer.java:737)
       at android.view.Choreographer.doFrame(Choreographer.java:669)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:911)
       at android.os.Handler.handleCallback(Handler.java:790)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:192)
       at android.app.ActivityThread.main(ActivityThread.java:6702)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)
t

Tash

06/18/2022, 9:36 PM
Is the news feed the first time in the app flow that you load up something in Compose? That thread plus this suggests that if you load up Compose earlier in your app flow, for ex a splash screen or something, it might help reduce the load of "compose rendering for the first time later on in a complex screen", from my understanding
56 Views