50 Android Studio Tips, Tricks & Resources you should be familiar with, as an Android Developer

(⌐⊙_⊙)

The reason of this article, is to list helpful tips, tricks, shortcuts and resources for Android Studio to improve your overall efficiency and performance. There are obviously many many more optimizations, shortcuts etc., but for sake of keeping this article short, I limited it to a sum of 50 points. Hope you will enjoy it!

Visual

  1. Material Colors theme for Android Logcat

    Material Colors Logcat

    To change Android Studio Logcat you need to go to:
    Preferences (Settings on Windows / Linux machines) --> Editor —-> Colors & Fonts -—> Android Logcat
    and change the foreground color for every type of log.

    My material colors

    Assert #BA68C8
    Debug #2196F3
    Error #F44336
    Info #4CAF50
    Verbose #BBBBBB
    Warning #FF9800
  2. Prevent Android Studio Logcat from clearing the log for the current application when it crashes.
    To do that you need to go to the Android Monitor panel and choose Edit filter configuration on the right side dropdown.

    Preserving Logcat

  3. Apply a proper code style to your IDE (IntelliJ / Android Studio). Go to Preferences --> Code Style --> Java and in a Scheme dropdown you can choose your code style (or set up a new one). 2 styles which are especially worth to mention:

    Importing Google code style

  4. Use split screen for increasing efficiency.

    Split screen view

    To turn this feature on, you need to right mouse click on the tab of your main screen and choose Split Vertically / Horizontally feature.

    Split screen view turn on

    But to be as efficient as possible we need to set up a custom keyboard’s shortcut. To do that go to Preferences --> Keymap and search for Split Vertically. Then open a context menu and click Add Keyboard Shortcut. In my case, for vertical split view I added control + alt + v. It is shown on a gif below. You can define the shortcut for a horizontal split view as well.

    Split screen view keyboard shortcut

  5. Distraction Free Mode. You can enable it by going to: View --> Enter Distraction Free Mode

    Enter distraction free mode

    In the distraction-free mode, the editor occupies the entire IntelliJ IDEA frame, without any editor tabs and tool-window buttons. The code is center-aligned.1

  6. Use Live Templates

    • you can use a shortcut: cmd + j (Windows / Linux: ctrl + j)

    cmdj

    • you can use many already defined templates, like for Toasts or if conditions.

    toast

    ifn

Shortcuts and helpful commands

  1. The best and the most helpful command Search for command: cmd + shift + a (Windows / Linux: ctrl + shift + a).

    Let’s say you want to close current tab and you don’t know how. You just type: close and you will get a proper shortcut / command.

  2. Choose from the last copy / pastes (manage your clipboard): cmd + shift + v (Windows / Linux: ctrl + shift + v).
    By default there are 5 last copy/paste items.

    Choose Content to Paste

    The depth of the Clipboard stack is configured in the Limits section on the Editor page of the Settings dialog box. When the specified number is exceeded, the oldest entry is removed from the list.2

  3. Enable multicursor feature: control + g (alt + j for Windows / Linux).

    Multicursor

    A detailed article about this feature is provided by Bartosz Lipinski on Medium. Highly recommended!

  4. Open a class: cmd + o (Windows / Linux: ctrl + n).

  5. Open any file: cmd + shift + o (Windows / Linux: ctrl + shift + n).

  6. Open symbol: cmd + option + o (Windows / Linux: alt + shift + n).

  7. Go to implementation: cmd + option + b (Windows / Linux: ctrl + alt + b).
    Let’s say you have an interface. By clicking on the interface name and then clicking the Go to implementation shortcut, you will be redirected to classes which implement that interface.

  8. Go to declaration: cmd + b (Windows / Linux: ctrl + b).
    It allows you to quickly check and go to a declaration of a class, method or a variable.

  9. Go to type declaration: control + shift + b (Windows / Linux: ctrl + shift + b).
    Let’s say you defined:

     Employee employee = new Employee("Michal");
    

    When your caret is on employee and you click the shortcut, you will be redirected to the Employee class.

  10. Go to super: cmd + u (Windows / Linux: ctrl + u).
    For instance, you override some method. When your caret in on the method’s name and you click Go to super shortcut, you will be redirected to the parent method.

  11. Move between tabs: cmd + shift + [ (move left) or cmd + shift + ] (move right) (Windows / Linux: alt + ← / →).

  12. Move between Design / Text tabs in layout’s view: control + shift + ← / → (Windows / Linux: alt + shift + ← / →).

  13. Close a current tab: cmd + w (Windows / Linux: ctrl + F4).

  14. Hide all windows: cmd + shift + F12 (Windows / Linux: ctrl + shift + F12).

  15. Minimize Android Studio instance: cmd + m (Windows / Linux: ctrl + m).

  16. Format your code: cmd + option + l (Windows / Linux: ctrl + alt + l).

  17. Auto-indent lines: control + option + i (Windows / Linux: ctrl + alt + i).

  18. Implement methods: control + i (Windows / Linux: ctrl + i).
    Let’s say you implement an interface. Then, you can quickly import all methods provided by that interface, just by clicking this shortcut.

  19. Smart code completion (filters the list of methods and variables by expected type): control + shift + space (Windows / Linux: ctrl + shift + space).

  20. Find: cmd + f (Windows / Linux: ctrl + f).

  21. Find and replace: cmd + r (Windows / Linux: ctrl + r).

  22. Move hardcoded strings to resources: option + return (Windows / Linux: alt + enter). The shortcut must be used when a caret is on a text. Check the gif below:

    alenter

    If you use that shortcut globally, the IDE will do Project quick fix (show intention actions and quick fixes).

  23. Build and run: control + r (Windows / Linux: shift + F10).

Plugins

  1. Key promoter - a plugin which will help you to use a keyboard more often :smile:
  2. String Manipulation - a plugin which provides actions for text manipulation (e.g. toggling styles like camelCase, hyphen-lowercase etc., capitalize text and many more).
  3. Android Material Design Icon Generator - this plugin helps you to set Material Design icons to your Android project. After installation you can use a shortcut: cmd + shift + m to generate an icon (by default).
  4. ButterKnifeZelezny - simple plugin that allows one-click creation of Butterknife view injections.
  5. IntelliJ/Android Studio Plugin for Android Parcelable boilerplate code generation - a plugin that generates an Android Parcelable implementation based on fields in the class.
  6. ADB Idea - a plugin that helps and automates adb commands to:
    • Uninstall an application
    • Kill the application
    • Start the application
    • Restart the application
    • Clear the application data
    • Clear the application data and restart
  7. Genymotion plugin - this plugin allows you to create and start Genymotion virtual devices from Android Studio.
  8. Android Methods Count - a plugin that parses your Android library dependencies and shows the methods count as an handy hint.
  9. Git Flow Integration - a plugin for introducing a Git Flow branching model.3
  10. Builder plugin - a plugin (from Square) that generates a static nested Builder for a class.

Resources

  1. Android Studio Tips of the Day by Philippe Breault
  2. Keyboard Shortcuts Reference
  3. (About) 10 Things You (Probably) Didn’t Know You Could do in Android Studio by Reto Meier
  4. Mouseless Driven Development by Hadi Hariri
  5. Android Studio Like a Boss by Philippe Breault
  6. Android Studio for Experts (Android Dev Summit 2015)
  7. Android Studio Tips and Tricks by Michael Evans
  8. Meet Android Studio
  9. Android Studio – Tips and Tricks by Donn Felker
  10. Debug Your App with Android Studio
  11. What are some of your must-have plugins for - Reddit discussion

That’s it! Please let me know about your useful tips & tricks or resources.