Has anyone here experienced `View.measure` crashes...
# compose
s
Has anyone here experienced
View.measure
crashes in Accompanist (probably accompanist-pager) starting on v0.19.0? Suspect it comes from the refactor to using a
LazyList
introduced in that version, and we're seeing it across multiple devices in production, but we're unable to reproduce it locally, and we're a little lost on how to debug this. 😅 GitHub issue: https://github.com/google/accompanist/issues/847
👍🏼 1
👍 3
a
SizeModifier
appears in the stack trace but Pager doesn't seem to use any size modifiers. Are you using size modifiers (`Modifier.size()`/`Modifier.width()`/`Modifier.height()` or those with
required
) which constrain the same axis as Pager in your code? If so, can you post it?
z
I saw a lot of this earlier on, no longer the case though - using
0.21.3-beta
(not sure if I accidentally fixed it locally, or the updates did). Care to share some code?
s
We experienced this exact problem too when the code looked like this on accompanist 0.20.0. It hasn’t appeared yet after we’ve downgraded to 0.18.0 on this commit but I’m keeping an eye on it. Mentioned here that we only got it however on a very specific API-device combo, worked fine on all the other devices I tried it on, even on another Android 9 Samsung device.
l
Mentioned here that we only got it however on a very specific API-device combo, worked fine on all the other devices I tried it on, even on another Android 9 Samsung device.
That's strange, for me the issue is also on Android 11 / 10 / 8.1.0 and on many devices. Here's some screenshots of the issue from Sentry (before I rollback to Accompanist 0.18.0).
🤔 1
a
It turns out that Pager does use size modifier and the crash is happening during the measurement of `Modifier.fillParentMaxWidth()`/`Modifier.fillParentMaxHeight()` here. However I have no idea why.
l
Two days ago they changed this part to fix some issue with measurements here. Wondering if this will fix the issue 🤔
s
But it should be okay to use `fillParentMaxWidth()`/`fillParentMaxHeight()`, though, shouldn't it? I sort of get why this could happen if one used `fillMaxWidth()`/`fillMaxHeight()`, since the lazy lists have infinite width/height, but that's not the case here. Also, there are even checks in Compose's layout measuring to see if the size is
Infinity
(
== Int.MAX_VALUE
), in which case it should use the
minWidth
instead. In our crashes, we're seeing
Int.MAX_VALUE - 127
, however.
a
Yeah it should be ok, and that’s why it’s a bug.
s
Ahh, like that! 😅