One liner for adb devices

I've been working with Android since my Azure Spatial Anchors days, when I was working on a number of client SDKs, including native and Java versions.

These days I'm working on a Mac more frequently than on Windows, and so occasionally I'll use a quick one-liner to wait for a device to be recognized by adb after plugging it in.

Here goes in one go: while true; do if (adb devices | grep device$); then echo found; break; else echo waiting for device ... ; sleep 5; fi; done

As usual, it's nice to get a clearer breakdown of what this does ...

Happy Android development!

References:

Tags:  androidshell

Home