Status Update
Comments
ro...@veeva.com <ro...@veeva.com> #2
Can you try with the latest snapshot? Not reproducible for me on androidx-main.
la...@yumzy.in <la...@yumzy.in> #3
Ok, after trying a couple more versions, realized this is a duplicate of
From the release notes:
AndroidView's update callback's first invocation will now be defered until the view is attached, instead of running when the composition that introduces the AndroidView is applied. This fixes a bug where the update callback wouldn't be invalidated if a state it read was changed immediately by an effect. (Ie9438,
) b/291094055
Sorry for the confusion!
pr...@salesforce.com <pr...@salesforce.com> #4
[Deleted User] <[Deleted User]> #5
la...@yumzy.in <la...@yumzy.in> #6
[Deleted User] <[Deleted User]> #7
la...@gmail.com <la...@gmail.com> #8
gl...@gmail.com <gl...@gmail.com> #9
Same problem with 1.6.0-alpha07 but I can't downgrade it to a "stable" one, for other reasons relating to certain instabilities issues.
co...@protonmail.com <co...@protonmail.com> #10
Are people still seeing this in alpha08? I want to see if I should just rollback to stable, or just rollback to a different alpha version?
gl...@gmail.com <gl...@gmail.com> #11
I got the same bug with 1.6.0-beta01 androidx compose libraries versions and 1.2.0-alpha11 MDC3 version:
Fatal Exception: java.lang.IllegalStateException: replace() called on item that was not placed
at androidx.compose.runtime.collection.MutableVector.forEach(MutableVector.java:466)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$LookaheadPassDelegate.replace(LayoutNodeLayoutDelegate.java:525)
at androidx.compose.ui.node.LayoutNode.lookaheadReplace$ui_release(LayoutNode.kt:923)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureAndRelayoutIfNeeded(MeasureAndLayoutDelegate.kt:488)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureAndRelayoutIfNeeded$default(MeasureAndLayoutDelegate.kt:463)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureAndLayout(MeasureAndLayoutDelegate.kt:354)
at androidx.compose.ui.platform.AndroidComposeView.measureAndLayout(AndroidComposeView.android.kt:972)
at androidx.compose.ui.platform.AndroidComposeView.handleMotionEvent-8iAsVTc(AndroidComposeView.android.kt:1493)
at androidx.compose.ui.platform.AndroidComposeView.dispatchTouchEvent(AndroidComposeView.android.kt:1467)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3863)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3551)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3863)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3551)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3863)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3551)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3863)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3551)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3863)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3551)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3863)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3551)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:733)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1922)
at android.app.Activity.dispatchTouchEvent(Activity.java:4051)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:70)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:691)
at android.view.View.dispatchPointerEvent(View.java:14644)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6526)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6313)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5751)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5804)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5770)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5926)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5778)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5983)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5751)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5804)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5770)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5778)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5751)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8910)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8771)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:8724)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:9046)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:194)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(InputEventReceiver.java)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:183)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:8986)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:9073)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:996)
at android.view.Choreographer.doCallbacks(Choreographer.java:794)
at android.view.Choreographer.doFrame(Choreographer.java:722)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:981)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7948)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
le...@gmail.com <le...@gmail.com> #12
After the 9th release of Compose alpha that didn't fix this issue I decided to try to find a workaround for it and it seems that wrapping the LazyList
inside a androidx.constraintlayout.compose.ConstraintLayout
seems to avoid the crash.
Just replace this:
LazyColumn(
modifier = Modifier.fillMaxSize(),
) {
with this:
ConstraintLayout(modifier = Modifier.fillMaxSize()) {
LazyColumn(
modifier = Modifier
.constrainAs(createRef()) {
width = Dimension.matchParent
height = Dimension.matchParent
},
) {
So this seems to link the issue with a ConstraintLayout
and, after some more testing, I was able to reproduce the crash on every LazyList
that had items making use of ConstraintLayout
.
The crash was happening with the latest stable version of ConstraintLayout
so I tried the latest alpha, 1.1.0-alpha13
, and it solved the issue without the need of workarounds!
TL;DR
If you are using ConstraintLayout
, try the java.lang.IllegalStateException: replace() called on item that was not placed
crash for me.
Currently working versions:
androidx-compose = "1.6.0-beta01"
material3 = "1.2.0-alpha11"
constraintlayout-compose = "1.1.0-alpha13"
n....@gmail.com <n....@gmail.com> #13
androidxComposeCompiler = "1.5.6",
compose = "1.5.4"
kotlin = "1.9.21"
androidGradlePlugin = "8.2.0"
im not using constraint layout compose, and using stable libraries
mt...@google.com <mt...@google.com> #14
Issue is reproducible on T OS, Play store 39.7.26-29 [0] [PR] 606269484, Env Dogfood
Fingerprint: google/raven/raven:13/TQ2A.230505.002.G1/9946923:userdebug/dev-keys
02-12 11:09:55.088 12827 12827 E AndroidRuntime: FATAL EXCEPTION: main
02-12 11:09:55.088 12827 12827 E AndroidRuntime: Process: com.android.vending, PID: 12827
02-12 11:09:55.088 12827 12827 E AndroidRuntime: java.lang.IllegalStateException: replace() called on item that was not placed
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at ezz.R(PG:62)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at faz.r(PG:143)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at faz.i(PG:65)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at feo.m(PG:38)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at fch.a(PG:2)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at feo.dispatchDraw(PG:12)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at android.view.View.draw(View.java:23220)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at android.view.View.updateDisplayListIfDirty(View.java:22084)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4513)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4486)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at android.view.View.updateDisplayListIfDirty(View.java:22040)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4513)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4486)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at android.view.View.updateDisplayListIfDirty(View.java:22040)
02-12 11:09:55.088 12827 12827 E AndroidRuntime: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4513)
Please ref attached logs and bug report.
Description
Jetpack Compose component used: Lazy Colum and Lazy Row with Card
Android Studio Build: Android Studio Giraffe | 2022.3.1 Patch 1
Kotlin version: 1.9.0
Steps to Reproduce or Code Sample to Reproduce:
LazyColumn(
modifier = Modifier
.fillMaxWidth()
.nestedScroll(nestedScrollConnection),
state = listState
) {
item {
Card()
}
item {
Text()
}
item {
LazyRow() {
items(4) { Card() }
}
}
Stack trace (if applicable):
java.lang.IllegalStateException: replace() called on item that was not placed
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$LookaheadPassDelegate.replace(LayoutNodeLayoutDelegate.kt:1517)
at androidx.compose.ui.node.LayoutNode.lookaheadReplace$ui_release(LayoutNode.kt:926)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureAndRelayoutIfNeeded(MeasureAndLayoutDelegate.kt:471)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.access$remeasureAndRelayoutIfNeeded(MeasureAndLayoutDelegate.kt:39)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureAndLayout(MeasureAndLayoutDelegate.kt:352)
at androidx.compose.ui.platform.AndroidComposeView.measureAndLayout(AndroidComposeView.android.kt:908)
at androidx.compose.ui.node.Owner.measureAndLayout$default(Owner.kt:228)
at androidx.compose.ui.platform.AndroidComposeView.dispatchDraw(AndroidComposeView.android.kt:1156)
at android.view.View.draw(View.java:23303)
at android.view.View.updateDisplayListIfDirty(View.java:22151)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4592)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4565)
at android.view.View.updateDisplayListIfDirty(View.java:22097)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4592)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4565)
at android.view.View.updateDisplayListIfDirty(View.java:22097)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4592)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4565)
at android.view.View.updateDisplayListIfDirty(View.java:22097)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4592)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4565)
at android.view.View.updateDisplayListIfDirty(View.java:22097)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:682)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:688)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:786)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:4684)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4395)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3610)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2379)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9138)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1234)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1242)
at android.view.Choreographer.doCallbacks(Choreographer.java:902)
at android.view.Choreographer.doFrame(Choreographer.java:835)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1217)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:8061)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:703)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:923)