New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Android preview to android-ios compose template #3499
Comments
Hello! Thanks for the issue. |
Hey how are you thanks for your reply, compose plugin version is 0.6.1, I have also tried downgrading jdk to 11 , 16 and still the same. Im trying only to run this on the Android side, thanks. |
Thank you for providing information. Could you please try to create a new Android project and check if it works in it? |
Hey @mazunin-v-jb I have used this template https://github.com/JetBrains/compose-multiplatform-ios-android-template#readme I did not start it from scratch, surprisingly I cannot find any example that uses the @Preview annotation, is just me or for now is it having issues ? If you go to -> https://github.com/JetBrains/compose-multiplatform/blob/master/examples/README.md in any of these examples I cannot find the @Preview annotation on the androidMain folders , I assume that all the views are visualized on runtime. |
That's correct, that template doesn't have a preview setting for Android. We're planning to fix this later. |
Thanks a lot, is there any workaround I can do on that template to be able to use the preview ? |
Unfortunately, I can't provide a workaround for now. We'll try to fix it in the future. Please stay tuned, we'll inform here when we fix. |
Thanks a lot @mazunin-v-jb , I will be waiting and trying out new things, will close this for now :) |
or should we keep it open for when an update is available ? |
I added these settings inside the android block of the root build.gradle.kts
Besides this dependencies for androidMain
And my previews are showing Here is the repo: https://github.com/fernandozanutto/water-reminder |
Thanks a lot @fernandozanutto will try this one and let you know 👍 |
Ok, so, I have added
As @fernandozanutto suggested inside the
Inside androidMain in the Btw, on gradle.properties I'm using
|
This has been broken again with kotlin 1.9.10, compose 1.5.2, agp 8.0.2 |
Related PR and discussion here: JetBrains/compose-multiplatform-template#18 |
same with @realityexpander got this error |
To solve ambiguous behaviour in gradle plugin and make Layout Inspector work, you may define separate gradle module for Android build.gradle(:app) and for multiplatform build.gradle (:shared) with mentioned configuration #3499 (comment)
|
What are the versions of the plug-ins you are using for this? I tried to apply your suggestion to my project : https://github.com/realityexpander/FredsRoadtripStoryteller.git |
Check resources demo project here: https://github.com/virtanAnton/compose-multiplatform/tree/local-dev |
Why my ticket request feature link to this ticket which actually not answering my request which is compose preview not applicable in folder composeApp. |
Totaly agree, I haven't "Code/Splite/Design" buttons for files in composeApp folder at all. BTW Preview feature is very important, but all their template projects just ignore it, disappointed |
I know that preview can do inside android folder but it is wasting time double instead can focus only composeApp folder. Please make it visibile to view. Thanks in advance |
@hafiz013 Thanks for description. |
@dima-avdeev-jb take your time, you guys are doing an awesome job already porting compose to multiplatform, thanks a lot ! |
Agreed. Compose and KMP is best thing happened with mobile development last 10 years 👍 |
Following the thread... I would love to see the Preview issue fixed |
Do you use @Preview in commonMain ? But how? |
Linking it here to let others see the solution. |
Describe the bug
I'm trying to preview my composables on the android side to see what I'm doing before compiling.
I have added the preview tooling lib to the androidMain
And then used the @Preview annotation on my androidmain package inside my shared folder
I cannot even see the preview icon on the top right corner to see the composable preview
This is my setup
Affected platforms
Select one of the platforms below:
iOS(we don't support Preview on iOS, @dima-avdeev-jb )Versions
Expected behavior
I should be able to see the preview
The text was updated successfully, but these errors were encountered: