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 that will improve your overall efficiency
There are obviously many many more optimisations, shortcuts etc., but for sake of keeping this article short, I limited it to a sum of 50 points.
Hope you will enjoy it!
1. Material Colors theme for Android 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:
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.
3. Apply a proper code style to your IDE (IntelliJ / Android Studio).
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:
- Square Java Code Styles with Android
- Google Java Code Style.
You can import the theme as shown on the gif below:
4. Use split screen for increasing efficiency.
To turn this feature on, you need to right mouse click on the tab of your main screen and choose
Split Vertically / Horizontally feature.
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.
5. Distraction Free Mode.
You can enable it by going to:
View → 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. [IntelliJ Idea Viewing Modes]
6. Use Live Templates
- you can use a shortcut:
cmd + j(Windows / Linux:
ctrl + j).
- you can use many already defined templates, like for
Shortcuts and helpful commands
1. The best and the most helpful command is
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’ll 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.
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. [Cutting, Copying and Pasting in IntelliJ IDEA]
3. Enable multicursor feature:
control + g (
alt + j for Windows / Linux).
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’s 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
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).
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:
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).
- Key promoter - a plugin which will help you to use a keyboard more often.
- String Manipulation - a plugin which provides actions for text manipulation (e.g. toggling styles like camelCase, hyphen-lowercase etc., capitalize text and many more).
- 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 + mto generate an icon (by default).
- ButterKnifeZelezny - simple plugin that allows one-click creation of Butterknife view injections.
- IntelliJ/Android Studio Plugin for Android Parcelable boilerplate code generation - a plugin that generates an Android Parcelable implementation based on fields in the class.
- ADB Idea - a plugin that helps and automates adb commands to: uninstall, kill, start, restart, clear an application and clear the application data and restart it.
- Genymotion plugin - this plugin allows you to create and start Genymotion virtual devices from Android Studio.
- Android Methods Count - a plugin that parses your Android library dependencies and shows the methods count as an handy hint.
- Git Flow Integration - a plugin for introducing a Git Flow branching model.
- Builder plugin - a plugin (from Square) that generates a static nested Builder for a class.
- Android Studio Tips of the Day by Philippe Breault
- Keyboard Shortcuts Reference
- (About) 10 Things You (Probably) Didn’t Know You Could do in Android Studio by Reto Meier
- Mouseless Driven Development by Hadi Hariri
- Android Studio Like a Boss by Philippe Breault
- Android Studio for Experts (Android Dev Summit 2015)
- Android Studio Tips and Tricks by Michael Evans
- Meet Android Studio
- Android Studio - Tips and Tricks by Donn Felker
- Debug Your App with Android Studio
- 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.
I posted this article originally on my blog.