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

amar_1995

11/11/2019, 10:41 AM
I am using Android Canary 4 for android development using compose. I want to know is there any issue with compose or canary editor as it cannot able show preview window even after cleaning and rebuilding an app. I also noticed that even after adding file inside
resources
folder, editor shows error that file doesn't exists.
Is there any way to overcome this issue without restarting the editor each and everytime.
l

Luca Nicoletti

11/11/2019, 10:54 AM
It’s not clear what’s the problem
a

amar_1995

11/11/2019, 11:00 AM
I am not able to view preview window even after using
@Preview
function. Second problem is that even after adding drawable resource file inside
res
folder, editor show red as it wasn't able to find that file.
c

Carlos Muñoz

11/11/2019, 11:00 AM
can you share your
@Preview
function?
a

amar_1995

11/11/2019, 11:02 AM
Copy code
@Preview
@Composable
fun SettingPreview() {
    SettingTicket("Billing")
}
l

Luca Nicoletti

11/11/2019, 11:02 AM
Have you tried closing/reopening AS? 🧌
a

amar_1995

11/11/2019, 11:03 AM
Closing the entire editor and restarting solve this issue.
l

Luca Nicoletti

11/11/2019, 11:04 AM
And what if you update the message and rebuild?
It the @Preview updated?
Or do you have to restart the IDE everytime?
a

amar_1995

11/11/2019, 11:07 AM
Once the preview got loaded it work fine. Update show in preivew after refresh. But if I create new file with new preview function then I need to restart entire editor to see the preview window.
l

Luca Nicoletti

11/11/2019, 11:08 AM
Just use a
Preview.kt
file which holds all the `@Preview`s 🧌
a

amar_1995

11/11/2019, 11:09 AM
Okay 👍
a

Andrey Kulikov

11/11/2019, 11:37 AM
Probably just closing and opening again the file also helps. It is currently needed when you introduce the first preview in the file to workaround the bug
l

Luca Nicoletti

11/11/2019, 11:38 AM
Is there a bug filed for this? Can we have a link?
l

Luca Nicoletti

11/13/2019, 8:40 AM
Thanks! 🙂