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

Maciej Czekański

03/30/2022, 1:43 PM
Hey, does anyone has workaround for this @Preview error?
Copy code
The following classes could not be instantiated:
- androidx.compose.ui.tooling.ComposeViewAdapter (Open Class, Show Exception, Clear Cache)
 Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE.  If this is an unexpected error you can also try to build the project, then manually refresh the layout.  Exception Details java.lang.ClassNotFoundException: androidx.customview.poolingcontainer.R$id
It happened to me after updating compose to
1.2.0-alpha06
. It doesn't work both on Chipmunk and Dolphin
👀 1
it does work for me on Google's sample compose apps, but I couldn't figure out the differences in the setup. So far I gave up and I'm waiting for the next release...
m

Maciej Czekański

04/06/2022, 12:51 PM
stacktrace looks different
m

miqbaldc

04/07/2022, 7:20 AM
any updates regarding this? maybe compose tooling team?
m

Maciej Czekański

04/07/2022, 7:23 AM
I figured it out, I'll let you know later
🙏 1
Try adding
androidx.customview:customview-poolingcontainer:1.0.0-alpha01
dependency
👀 2
🤯 1
f

Filip Wiesner

04/07/2022, 7:58 AM
Holy shit, I was about to say that it should not make a difference because that dependency should already be on path but it worked 😮 Thank you
m

Maciej Czekański

04/07/2022, 7:59 AM
I spent probably a few hours on that since alpha06... 😞
🙏 2
♥️ 2
c

Chris Sinco [G]

04/07/2022, 8:06 AM
We are working to on a fix to prevent folks needing to add that transitive dependency explicitly for Preview but still working on it
🙏 1
👌 4
t

Tash

05/24/2022, 12:50 AM
Is there any update to this issue? Still seems to be happening on
1.2.0-alpha08
🤔
c

Chris Sinco [G]

05/24/2022, 2:02 AM
What version of Studio are you using? And is this still happening for you on beta01+?
t

Tash

05/24/2022, 2:32 AM
Seeing the issue on 2021.1.1. Patch 3 & 2021.2.1. Trying on 2021.3.1 Beta 1 Haven’t tried Compose beta yet
c

Chris Sinco [G]

05/24/2022, 3:25 AM
Do you have a code snippet handy to help repro on my side?
t

Tash

05/24/2022, 5:51 PM
Working on a minimal repro project
🙏 1
Minimal repro: this happens when using previews in an android library module +
1.2.0-alpha08
+
Kotlin 1.6.20
Looks to be this issue: https://issuetracker.google.com/issues/227767363 and adding
Copy code
debugImplementation("androidx.customview:customview:1.2.0-alpha01")
debugImplementation("androidx.customview:customview-poolingcontainer:1.0.0-beta01")
seems to get rid of it. wondering if there’s an alternative though?
Update: seems to be working on the latest Dolphin 2021.3.1 Beta 1 (without workaround)
👍 1
c

Chris Sinco [G]

05/26/2022, 3:55 PM
Yeah it’s a Studio issue and shouldn’t require adding more dependencies (that is it’s not a library issue per se). It should be fixed in Dolphin beta which looks like you’ve found that it does! 😌
🙏 1
🙏🏼 1
1580 Views