Hey, does anyone has workaround for this @Preview ...
# compose
m
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
stacktrace looks different
m
any updates regarding this? maybe compose tooling team?
m
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
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
I spent probably a few hours on that since alpha06... 😞
🙏 2
♥️ 2
c
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
Is there any update to this issue? Still seems to be happening on
1.2.0-alpha08
🤔
c
What version of Studio are you using? And is this still happening for you on beta01+?
t
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
Do you have a code snippet handy to help repro on my side?
t
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
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
1775 Views