With @Preview, what is the best way to debug/log v...
# compose
o
With @Preview, what is the best way to debug/log values?
👀 1
1
c
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
You can deploy individual Previews to a device (emulator/physical), then look at println/Log statements as usual via Logcat
o
@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
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
@Chris Sinco [G] Bumblebee 2021.1.1 and compose 1.1.1
c
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
@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
To collect logs, go to Help menu > Collect Logs and Diagnostic Data
218 Views