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

Ankur Gupta

02/25/2022, 5:27 PM
Hey! Is it possible to print logs while using Previews especially Interactive Previews?
c

Chris Sinco [G]

02/26/2022, 1:31 AM
It is not as Interactive Preview is running in a sandbox that is not the same as running on device. You can always deploy specific Previews to device, which you can then see your print statements working.
👍 1
m

mattinger

02/26/2022, 3:49 AM
@Ankur Gupta what i’ve been doing is deploying the preview to an emulator, and using a DisposableEffect to setup timber within the function annotated with @Preview
Copy code
DisposableEffect(key1 = true) {
            Timber.plant(Timber.DebugTree())
            onDispose { 
                Timber.uprootAll()
            }
        }
👍 1
a

Ankur Gupta

02/26/2022, 12:05 PM
Thanks guys, it's helpful!