https://kotlinlang.org logo
j

Jesse Hendrickson

09/15/2023, 4:04 PM
Hi folks, II have a very strange flickering bug with Compose `Icon`s that I’m soliciting ideas for. Sometimes, Icons my app’s
BottomNavigation
`Icon`s will randomly flicker (see video). When stepping through the video frame by frame, you can see that it seems that they’re only partially drawn in certain frames. Does anyone have any ideas as to what’s going on here? Steps I’ve tried in the thread: 🧵
• I’ve confirmed that there are no recompositions or re-layouts happening during flickering.Each icon is a vector asset with a tint applied. (.SVG ->
vector
XML • If I replace the
BottomNavigationBar
with a simple Row of Boxes and Icons, it still happens. • If I replace the Icon `painterResource`s with other icons used in the app, it still happens. • Only this bottom bar is affected (95% sure). No other
Icon
composables in the app have this problem. • If I move the same Icon resources to other parts of the app (like the AppBar), they do not flicker. • This happens on both debug and production builds. Though it feels more common on debug builds on the emulator than a real device.
I appreciate any suggestions here!
e

eygraber

09/15/2023, 4:14 PM
Just saw this in the slack Android app 😅 My guess would be https://issuetracker.google.com/issues/297231233
thank you color 1
j

Jesse Hendrickson

09/15/2023, 4:48 PM
Interesting, will take a look into this!
Though I’m using Compose BOM 2023.08, which maps to Compose 1.5. I’m using
androidx.compose.foundation:foundation:1.6.0-alpha01
j

JustinBis

09/15/2023, 6:56 PM
Are you seeing this in a release build? (Answer above). I've been experiencing some odd bugs with debug builds recently with vector drawing. The
Icon
was drawing one of the vector strokes with more weight than other strokes in the same vector. Possibly in the same family of issues.
j

Jesse Hendrickson

09/15/2023, 7:02 PM
Oh hey @JustinBis 👋 ! Yes, it’s happening on Release Builds. I’m going to dig into the linked issue now, as that seems like the primary lead. Sadly I can’t revert to Compose 1.5 due to dependent APIs. I haven’t seen any stroke weight issues, though.
👋 1
❤️ 1
j

JustinBis

09/15/2023, 7:03 PM
I'm on Compose 1.5 and haven't seen flickering or reproed my issue in release builds so I attributed mine to a bug with debug or live edit. I think the linked Google issue is your best bet for alpha issues. Worth adding your experience to the bug.
❤️ 1
j

Jesse Hendrickson

09/15/2023, 7:18 PM
Definitely, will update the issue once I’ve spent more time digging in and confirming it’s related.
c

Colton Idle

09/16/2023, 1:41 AM
do you use accompanist placeholder/shimmer library?
updating to latest 1.6.0 alpha06 got rid of the issue for me
a

ascii

09/16/2023, 4:01 AM
There's no 06; 05 is the latest and yes that fixes it for that specific instance. I saw your issue comment so maybe it was a typo.
It could just be an generic issue with every alpha version before 05. @Jesse Hendrickson try 05.
j

Jesse Hendrickson

09/16/2023, 9:31 PM
alpha05 is the latest version I can find: https://mvnrepository.com/artifact/androidx.compose.foundation/foundation This still repros for me on that version. Will continue trying to find a work around!
c

Colton Idle

09/17/2023, 6:51 PM
whoops. yeah, maybe i typod. sorry
j

Jesse Hendrickson

09/18/2023, 2:30 PM
For posterity: My issue was caused by Compose 1.6: https://issuetracker.google.com/issues/297231233 On the issue, I’ve added a workaround I’m using until the library is fixed.