https://kotlinlang.org logo
a

alorma

01/14/2021, 7:13 PM
Hi! How to solve this error on composable preview? compose:alpha10, ui-tooling:alpha07
Copy code
java.lang.NoSuchMethodError: 'androidx.compose.runtime.SlotTable androidx.compose.runtime.Composer.getSlotTable()'   at androidx.ui.tooling.InspectableKt.Inspectable(Inspectable.kt:63)   at androidx.ui.tooling.preview.ComposeViewAdapter$WrapPreview$1.invoke(ComposeViewAdapter.kt:357)   at androidx.ui.tooling.preview.ComposeViewAdapter$WrapPreview$1.invoke(ComposeViewAdapter.kt:-1)   at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:146)   at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:-1)   at androidx.compose.runtime.AmbientKt.Providers(Ambient.kt:188)   at androidx.ui.tooling.preview.ComposeViewAdapter.WrapPreview(ComposeViewAdapter.kt:356)   at androidx.ui.tooling.preview.ComposeViewAdapter.access$WrapPreview(ComposeViewAdapter.kt:-1)   at androidx.ui.tooling.preview.ComposeViewAdapter$init$1.invoke(ComposeViewAdapter.kt:397)   at androidx.ui.tooling.preview.ComposeViewAdapter$init$1.invoke(ComposeViewAdapter.kt:-1)   at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:146)   at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:-1)   at androidx.compose.runtime.AmbientKt.Providers(Ambient.kt:188)   at androidx.compose.ui.platform.AmbientsKt.ProvideCommonAmbients(Ambients.kt:274)   at
i

Ian Lake

01/14/2021, 8:00 PM
You can't mix and match Compose versions, they all need to be identical (and related libraries like Accompanist, Navigation Compose, etc. need to be built with that exact version of Compose as well). This error is usually indicative of using incompatible versions of different artifacts
n

Nick

01/15/2021, 9:00 AM
I have had this exact error for a few weeks now. Recently upgraded compose to alpha-10 and still the same. My alpha components are: • compose
alpha-10
• ui-tooling
alpha-07
• compose-ui
alpha-10
• navigation-compose
alpha-05
a

alorma

01/15/2021, 9:00 AM
uhmmm @Ian Lake, only mixed up is the ui-tooling, that has no alpha10 version
n

Nick

01/15/2021, 9:03 AM
yes, and surely if this is broken for everyone there would be a lot of noise on here? Not just two people?
@alorma I think that @Ian Lake is on the right track. I looked at the getting started with compose documentation and I noticed that there is an alpha-10 version of ui-tooling, but also that the namespace has changed. So in my project, I changed
implementation "androidx.ui:ui-tooling:1.0.0-alpha07"
to
implementation 'androidx.compose.ui:ui-tooling:1.0.0-alpha10'
This seems to have gotten rid of the original error you report in every preview window 🙂 but now I have to go and change the module name in every module on my project that uses
@Preview
😞 to
androidx.compose.ui:ui-tooling
. I’ll let you know how I go…
a

alorma

01/15/2021, 9:42 AM
aaaaaaaaaah amigo!
n

Nick

01/15/2021, 10:50 AM
hmmm…this still is not working for me. Now I have no preview window at all. Did you get anywhere?
a

alorma

01/15/2021, 11:09 AM
no, I can't try it now
Yes, It works for me
n

Nick

01/15/2021, 12:35 PM
Glad to hear it. For me, the preview pane no longer shows up at all. Can you share what is in your app-level Gradle file so I can compare?
just the dependencies section
n

Nick

01/15/2021, 5:26 PM
thanks, finally got it working when I noticed how out of date my copy of Android Studio was. Previews are happy again