As an Android developer, I live my life one repetitive task after another:

  • Clean, Run
  • Uninstall, Run
  • Restart
  • Clean, Restart
  • Restart with Debugger

Click here, click there. Tap on the phone. Open menu. Tap menu.

It never ends.

Plug-in to the rescue

To ease up the pain, we developers tend to create tools and one of my trusty companions is ADB Idea, a plugin for IntelliJ and Android Studio that adds a new menu:

A few classic commands that I use are:

  • Clear App Data and Restart
  • Restart App with Debugger

I also often use Uninstall App, but 99 times out of 100, it’s followed by Run, so at some point I though:

There must be a way to combine this two commands!

Turns out there is a way!

Macros to the rescue

IntelliJ and Android studio have Macros, a way to record a sequence of commands and later run it in one shot.

You can create a macro from the Edit menu:

Now the macro recording started and we can select the first command:

Then we select the second one:

We can now stop the recording:

We choose a name:

And we are done! We now have a new menu item:

We can run the macro in multiple ways: the menu above or via Find Action (Cmd + Shift + A):

We can even assign a keyboard shortcut:

to be able to quickly Uninstall and Run the current app with a super fast⚡keys combination 💪🏻

Conclusions

In this quick tutorial, we learned about:

  • ADB Idea, a plugin that makes fast and handy a few routine tasks in an Android dev life;
  • IntellJ/AS macros, an incredible way to bundle commands and run them all together, as we need them.