> For the complete documentation index, see [llms.txt](https://droidcon.gitbook.io/2016-berlin-barcamp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://droidcon.gitbook.io/2016-berlin-barcamp/schedule/android-studio-productivity-lessons-learned.md).

# 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.

![Android Studio logo](https://github.com/marsicdev/marsicdev.github.io/raw/master/images/as-logo.png)

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.

![No more Tabs](https://github.com/marsicdev/marsicdev.github.io/blob/master/images/as-setup-no-tabs.png)

## 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?

![Distraction free mode](https://github.com/marsicdev/marsicdev.github.io/raw/master/images/as-setup-destraction-free.png)

## 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:

* [ADB Idea](https://github.com/pbreault/adb-idea) - debug android app over Wi-Fi
* [Android WiFiADB](https://github.com/pedrovgs/AndroidWiFiADB) - debug android app over Wi-Fi
* [Inner Builder](https://github.com/analytically/innerbuilder) - adds a 'Builder' action to the Generate menu
* [CodeGlance](https://github.com/Vektah/CodeGlance) - displays a zoomed out overview or minimap
* [Android Parcelable](https://github.com/mcharmas/android-parcelable-intellij-plugin) - generates an Android Parcelable implementation based on fields in the class

## 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

* [Android Studio for Experts (Android Dev Summit 2015)](https://www.youtube.com/watch?v=Y2GC6P5hPeA)
* [Mouseless Driven Development by Hadi Hariri](https://vimeo.com/98922030)
* [The experts’ guide to Android development tools](https://www.youtube.com/watch?v=hHnTIMjd1Y8)

### Articles

* [The powerful Android Studio](http://saulmm.github.io/the-powerful-android-studio) - Saúl Molinero
* [{dev} tips](https://medium.com/sebs-top-tips) - Sebastiano Poggi
* [No Tabs in IntelliJ IDEA](http://hadihariri.com/2014/06/24/no-tabs-in-intellij-idea/) - Hadi Hadiri
* [Android Studio tips of the day](http://www.developerphil.com/android-studio-tips-of-the-day-roundup-1/) - Developer Phil

### Cheatsheet

* [IntelliJ IDEA Shortcuts Reference Card](https://resources.jetbrains.com/assets/products/intellij-idea/IntelliJIDEA_ReferenceCard_mac.pdf)
* [Presentations slides](http://marsic.info/files/AS_productivity-Marko_Arsic-DroidCon_Berlin_2016.pdf) containing all links already listed above

*Speaker:* [Marko Arsic](http://marsic.info/) ([@mArsic](https://twitter.com/marsic))
