With the first patch for AS Arctic Fox Jetpack Compose previews stopped working.
I’m getting this error for all previews – even older ones, which worked fine a while back:
android.content.res.Resources$NotFoundException: Could not resolve resource value: [some hex value]
Are here any quick fixes for this? Clearing caches and the usual stuff did not work.
EDIT:
Looks like the problem is not always present. Some preview started working, while other are still failing.
EDIT 2:
This is happening in dynamic feature modules, when there’s a need for resources from the main module or painterResource()
is being used (even is resource from the same module is to be displayed).
4
Answers
This got fixed in AS Bumblebee, patch 2.
Edit (copied from comments): It then got broken again in
Electric Eel | 2022.1.1
and fixed again inFlamingo | 2022.2.1 Beta 4
.As a temporary hack workaround I did this to get past the error and preview the UI elements.
Same problem here with dynamic-modules project.
Inspired by above answer, I’ve made another temporary workaround while waiting for Compose team to fix this.
For me it starts working after run the application on a simulator (2022.1.1)