ADB helper

tl;dr: I’ve rewritten most of my adb related bash scripts and aliases that have accumulated over the years into a single tool that can be found here.


Beginnings Link to heading

Fifteen years ago I started work on creating my very first Android app.

It was part of a university computer science course designed to guide us through the complete software development life cycle — design, gathering requirements, implementation, and deployment — rather than the focus on fragmented software concepts that other classes had.

At that time, I was an active volunteer with the Icelandic Search and Rescue team, and had just participated in a large-scale training exercise simulating a response to a plane crash. One of the critical tasks in such scenarios is to send out a first wave of triage teams to assess the condition of survivors and casualties.

As part of the exercise, we trained in performing quick evaluations of each casualty we found and in using colored flags to prioritize care. These flags would then be used by the next wave of first responders, to determine where and how to prioritize their care. However, the only way to report back to the field command center was via radio, which left much to be desired when it came to delivering all the information about the broader situation on the ground.

So, when brainstorming ideas for this course project, I thought: why not develop something that could allow first responders to use their smartphones to relay both the condition and location of survivors to a central hub? This would then enable the command center to direct responders to those most in need of immediate care, as well as give them better situational awareness.

It’s funny now, looking back, but smartphones were practically nonexistent at the time, and none of us had any experience with Android development. But somehow, I convinced a couple of classmates to join me in tackling this project.

Long story short, we spent a significant amount of time just getting the emulators up and running and learning how to build something that would run on this new platform. But eventually, we were able to create a rough prototype that could transmit basic location data and survivor information to a central server, and display it on a map overlay.

Though the original code is lost to time (probably for the best), I still have this one screenshot as a memento of that project:

A screenshot of my first Android application showing an embedded Google Maps of Keflavík airport along with overlay pins

As is often the case when new technology comes around, me and a lot of my classmates ended up going and working in this newly revitalized sector, called mobile development, after graduation and there is where I have spent almost the entirety of my career since.

Android Tooling Link to heading

Back in those early days, Android development documentation and tools were far less refined than they are now. Online communities were just in their infancy — Stack Overflow was barely a year old, Twitter was only two years old, and platforms like Slack, Discord, or the wealth of YouTube tutorials we’ve come to expect simply didn’t exist. Back then, if you wanted answers, your best bet was to post it to Google Groups.

Similarly, tooling was sparse, with no third-party options at all. We had the ‘Dalvik Debug Monitor Server’ (DDMS) and the ‘Android Development Tools’ (ADT) plugin for Eclipse. Yes, we used Eclipse for the first few years. I still remember the excitement in the office when Google announced Android Studio back in 2013.

A screenshot the 'Dalvik Debug Monitor Server' (DDMS)

Then there was adb, the backbone of much of the tooling available both back then as well as today. It offers a lot of functionality, and being a command-line tool, it only becomes more powerful when paired with the myriad of other CLI tools available.

Over time, I created many standalone Bash scripts and aliases using adb to handle the many daily work tasks I had, but they were always ad-hoc. I had to remember which alias or script performed what function, and over those 15 years the number of them had become unmanageable for me.

However that changed this summer when I decided to finally consolidate them into a single tool, simply called adb_helper.

It packs plenty of functionality, much of which is documented over at the wiki section, without trying to encapsulate everything that adb can do.

While some of its features, like modifying shared preferences or databases for applications in development mode, are now official features of Android Studio, I’ve been using these kinds of features since 2012 via my adb scripts, and I still prefer doing so on the command line to this day. Only difference is that from now on, I’ll use adb_helper.

Sometimes, the command line is simply the best interface for certain tasks.