Android Studio productivity - lessons learned

Android Studio brings tons of keyboard shortcuts that helps developers to keep hands more on the keyboard rather than relying much on the mouse. The lesser you use the mouse, results in faster development.

Here are some general tips how to boost your productivity and get your development on a higher level.

Here are some general tips how to boost your productivity and get your development on a higher level.

No more Tabs

There are many ways to navigate a project inside Android Studio that doesn’t necessarily include having to look through a list of tabs and figure out where you have to click next.

Switch tabs off. You don’t need tabs.

Distraction free mode

While you are coding you don't need in your sight all the small buttons and the line numbers that are around your editor. Actually, ask your self when was the last time that you looked at line number?

Plugins

Plugins can help you to do some boring everyday things like implementing parcelable code or generating some other boilerplate code that you need to do often or even with navigation. So choose your plugins carefully as they are you weapon of choice. Here are some that I'm using:

Shortcuts

Well, let us see some of the shortcuts for android studio for Mac user. If you get used to this shortcuts and remember them your coding and navigation will be peace of cake.

Default Android Studio Shortcuts

Command Type

Shortcut

Display list of available auto-fixes for code warning/error at cursor

Alt+Enter

Rename all copies of the variable/method/class at cursor

Shift+F6

Generate code (incl. getters, setters, constructors, method overrides)

Cmd+N

Reformat code to conform to Android Studio's default style

Cmd+Alt+L

Comment/Uncomment all selected lines (also works in xml files)

Cmd+/

Find text in the current file

Cmd+F

Search for and open any file by name (filters as you type)

Cmd+Shift+O

Search for and list any occurrences of text

Cmd+Shift+F

Search for and go to any symbol (incl. variables and methods)

Alt+Cmd+O

Find and replace in current file

Cmd+R

Show available parameters for current method

Cmd+P

Show class structure in pop-up

Cmd+F12

List all usages of the variable/method/class at cursor

Cmd+Cmd+F7

List recently viewed files in pop-up

Cmd+E

List recently edited files in pop-up

Cmd+Shift+E

List implementations/overrides of class/interface/method at cursor

Cmd+Alt+B

View code hierarchy for symbol in pop-up

Ctrl+Cmd+H

View full refactor menu

Ctrl+T

View javadoc of symbol at cursor in pop-up

F1

View definition of method at cursor in pop-up

Cmd+Y

Skip back/forward through cursor position history

Cmd+[/]

Go to the declaration of the variable/method/class at cursor

Cmd+B

Go to given line number in current file

Cmd+L

Go to next highlighted error in current file

F2

Move code line at cursor up/down

Alt+Shift+up/down

Move code block at cursor up/down

Cmd+Shift+up/down

Duplicate current line

Cmd+D

Complete statement (add braces, parentheses, semi-colon)

Cmd+Shift+Enter

Insert new line below current cursor position

Shift+Enter

Toggle Project sidebar Visibility

Cmd+1

Toggle Run sidebar Visibility

Cmd+4

Toggle LogCat sidebar Visibility

Cmd+6

Build and Run

Ctrl+R

Run

Cmd+F9

Debug

Ctrl+Alt+D

Clipboard history

Cmd+Shift+V

Project settings

Cmd+,

Custom Android Studio Shortcuts

For some common repetitive everyday tasks I added some custom shortcuts

Command Type

Shortcut

Sync with Gradle

Alt+Shift+S

Compare with same repository version

Cmd+Shift+D

Clean project

Cmd+Shift+L

Duplicate line

Ctrl+Cmd+down

Delete line

Cmd+D

References

This leacture was all about lessons learned from different articles and talks from some really awesome Android developers.

Videos

Articles

Cheatsheet

Speaker: Marko Arsic (@mArsic)

Last updated