Is it possible to make compose preview working in ...
# multiplatform
e
Is it possible to make compose preview working in the Android Studio Hedgehog | 2023.1.1 RC 3? Even if I move the function annotated with Preview to the Android source set it doesn’t show preview window in the AS. Although the preview on the device does work.
k
It should work. check your project build configs
e
I actually used the KMM Wizard from the Jetbrains website. Is it outdated?
@Konstantin Tskhovrebov
k
there is a button to create issue at the bottom of the page 😉 I didn't check it. but I fixed the same issue in my personal wizard (with the community help).
🔥 1
@akapanina ☝️
thank you color 1
e
I will try, thank you!
m
I can see the previews in AS Iguana. My composables belong to the common set, and I just import them and call them from preview annotated functions in the android source set.
d
Experiencing the same on Jellyfish: Using project from KMM Wizard; All preview dependency configurations look in place, the Compose plugin is installed, yet Previews only 'work' when installed on Emulator. There's no regular Preview gutter icon or tooling 🤔
Tellingly; a new Compose project from Jellyfish's own Wizard also suffers the same issue - no Compose Previews.
p
This is still not solved, right?
m
same advice, make a file in the android sourceset, create your preview functions there, done.
p
@McEna under
composeApp/androidMain
? or under
androidApp
? the later I get it to work but for the first one I can't get it to work 🤔
m
The latter, at that point the normal tooling operates
p
Understood, unfortunately that setup have a lot of shortcoming 😅 maybe I would add an additional preview module 😓
k
https://terrakok.github.io/Compose-Multiplatform-Wizard/ Take a look here. It has a preview under a compose app
p
@Konstantin Tskhovrebov I updated Android Studio and now it kmp.jetbrains.com works, I don't see any resent changes in the configurations so it's likely I was just using an old Android Studio. 🤦
👍 1