Sign in

We all know how to run adb logcat and some of us might have used a flag or two or piped the output to grep but what do we do if we need to access the contents of the log from on-device (e.g. when looking for the output file of our thread traces during a UIAutomator test)?

We can access the logcat from shell via the (you probably guessed it)logcat command. This command is documented quite extensively and provides quite a fair amount of options. …


If you’re debugging a Android application with Android Studio, it’s easy to inspect the stack traces of all the threads running in your application. But what do you do if you’re not able to attach the debugger? It may be that you’re running an out-of-process UIAutomator test or you’re just manually testing your application. We can utilize the on-device command kill with the signal SIGQUIT to dump our application’s thread stacks.

First, we’ll need to get the PID of our application. We can use the another on-device command ps for that. The -A flag will list all the running processes…


Some of Kotlin’s scope functions can be a bit confusing at first glance. Specifically, apply, also, let, and run. Even after using them quite a bit, I still need to think about each one’s behavior before adding a new one to my code. I’ve gotten a bit quicker at remembering the correct one but I thought a quick, runnable example would help myself and others visualize the differences. If you’re more of a textual learner, Kotlin’s own site has a table to enumerate each function’s distinctions.

The above example allows us to interactively see what we get with each of the scope functions. I thought about commenting the output of the println functions but I decided that guessing before running it would be a good exercise left to the reader.

Wes Alvaro

I'm a software engineer currently working on an Android app you might use everyday.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store