gitsome iterm2 theme

Mastering the Terminal side of Android development

As a terminal aficionado I’ve been wanting to write about this topic for awhile. Besides being cool, knowing how to use the terminal simply makes things faster. It’s much quicker to type a few letters and press TAB than to click through endless menu options.

My goal with this article is to share with you how I use the terminal in my android development workflow.


iTerm2 brings the terminal into the modern age with features you never knew you always wanted. This includes pane splitting, custom colour schemes, paste history, fine-grained control over hotkeys, together with dozens of other handy preferences that you will find useful as you become more comfortable in the terminal.


By default, oh-my-zsh comes with a git plugin which provides many aliases and a lot of useful functions.

Terminal Autosuggestions


Reverse intelligent search

Then you can either press Enter to execute the command again, use the arrow left or right key to edit the command, or keep pressing Control+R to cycle through other possible completions.

reverse intelligent search for “test”


  1. Click the download zip
  2. Extract the zip file
  3. Open Android Studio
  4. Import the project you just downloaded
  5. Sync gradle
  6. Run the project
  7. Choose the device you want to run
  8. Test all you want
  9. Delete the project folder and the zip file when you don't want it anymore


You can use dryrun:

dryrun running

Build faster, build offline

Assembling develop debug at full speed:

./gradlew assembleDevelopDebug --offline

Running your unit tests at full speed:

./gradlew test --offline

As an alternative, in Android Studio you can make gradle build your apps fully offline by activating this option:

Settings -> Build, Execution, Deployment -> Build tools -> Gradle

Notice the “offline work” checkbox


But do you know exactly that line?

For this purpose I’ve created ALFI:

  1. Type: alfi NAME_OF_THE_LIBRARY
  2. Copy the desired library;
  3. Paste in your build.gradle.

No UI interaction required and up to 20 results at once!

alfi picasso
Searching for picasso image loading library

Understanding gradle tasks shortcuts

  • iDD for installDevelopmentDebug
  • aDD for assembleDevelopmentDebug
  • cC for connectedCheck
  • etc.

You can start doing things like this:

./gradlew :App:iDD 

See, everything is smaller now.

Android Rocket Launcher

All you need to do is add 2 lines to your build.gradle

Tip: Don’t forget that even when you’re launching the app from the terminal you can always attach the process to the debugger, no need to restart the app in Debug mode.

Output unit tests directly to the console

android {
testOptions.unitTests.all {
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
outputs.upToDateWhen { false }
showStandardStreams = true

Now when you run your tests they will output something like this:

unit testing logging output

Convenient logcats

This small tool solves that problem by filtering by application package. Supply the target package as the sole argument and enjoy a more convenient development process.

pidcat github.cesarferreira.helloworld
pidcat logging a hello world app


  • Install iterm2, a better terminal than the default one;
  • Use the oh-my-zsh shell with autosuggestions;
  • compact the commands ./gradlew iDD
  • Run the commands faster by using the offline flag --offline
  • Pretty print your tests;
  • Don’t manually open the app on the phone after install, use this plugin to automate it;
  • Attach the process to debugger without restarting the app in debug mode;
  • Enjoy a more convenient logcat output with pidcat.

Wrap up

If you are interested in more Android development, please check my other articles, follow me on Twitter or check my GitHub projects.

Senior Android Developer, currently working as a Tech Lead @GlueHome. More on me @

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