Last time I wrote about how to get 100% code coverage on Kotlin nullable vars. This week I have a quick tidbit on how to run an app on multiple devices at once!
About a year ago, a coworker revealed a little-known secret — the window that appears in Android Studio when you want to run an app on a device supports multi-select! So, you can shift/command select multiple devices and the app would be installed/launched on all of them simultaneously — a very handy tool if you’re trying to debug something on multiple devices.
However, that was 2018, and now we have a new version of Android Studio, and this functionality is now available in a slightly different format. The new device menu in the toolbar has an option to “Run on multiple devices”:
Once you select that, you’ll get a pop-up window where you check a box next to each device you’d like to run the app on:
(It’s a little difficult to tell from this image, but there are different icons for physical devices vs. emulators)
Once you press the “Run” button, Android Studio will work its magic and install/launch the app on all of the devices you specified!
One interesting thing to note is that the “Run” console will combine and interleave the logs of all devices together, prepending the device’s ID before it:
I’ve found this can be a little difficult to read, so you may have better luck using the Logcat tab where you can view the logs separated out by device:
I hope this makes your life easier and please share this tidbit around — this feature is much more prominent in the UI now, but I imagine many people still don’t know it’s there. Do you have other favorite Android Studio features you find especially useful? Let me know in the comments below! And, please follow me on Medium if you’re interested in being notified of future tidbits.
This tidbit was originally delivered on August 22, 2018.
Top comments (0)