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

Orhan Tozan

03/23/2022, 12:13 PM
With @Preview, what is the best way to debug/log values?
👀 1
1
c

Csaba Szugyiczki

03/23/2022, 2:16 PM
Thats an awesome question! I had to throw exceptions to see what happens inside my preview, since I did not find a way to log anyting. A simple K
error("log something $value")
did the trick for me, but it is not elegant at all
c

Chris Sinco [G]

03/23/2022, 9:45 PM
You can deploy individual Previews to a device (emulator/physical), then look at println/Log statements as usual via Logcat
o

Orhan Tozan

03/24/2022, 11:12 AM
@Chris Sinco [G] do you have a video of someone using it? I tried it, but it glitches out my Android Studio (emulator gets turned on, but nothing is happening afterwards)
c

Chris Sinco [G]

03/24/2022, 6:12 PM
It’s expected to work since Arctic Fox. What issues are you seeing? Can you take a screen recording?
Here is screen recording of using the feature from both the Preview surface and the editor gutter
Hmm what version of Studio are you using and what version of Compose?
This is very odd, and we may need the logs to see what is happening
o

Orhan Tozan

03/26/2022, 12:17 PM
@Chris Sinco [G] Bumblebee 2021.1.1 and compose 1.1.1
c

Chris Sinco [G]

03/27/2022, 11:45 PM
Hmm I'm unable to repro with a basic project with that configuration. It also seems like something in general isn't working in your project as the Run button (in your recording) is disabled even before you use Deploy Preview.
Can you try to repro with a new Empty Compose Activity Project? If you can't, then it'd be very helpful to send us the logs generated when trying to use this feature with your project. You can either DM the logs zipped up to me, or file a bug on our public tracker.
o

Orhan Tozan

03/28/2022, 10:21 AM
@Chris Sinco [G] The Run button only gets disabled after I click "deploy to device". It stays disabled forever until I restart Android Studio. The reason why it was already disabled when the video started is because I already clicked the "deploy to device" earlier before the video started
😔 1
👍 1
@Chris Sinco [G] where can I find these logs?
c

Chris Sinco [G]

03/28/2022, 4:16 PM
To collect logs, go to Help menu > Collect Logs and Diagnostic Data
19 Views