Most used Android Studio Shortcuts every developer needs to know and create your own shortcuts

Droid By Me
7 min readOct 9, 2020

--

In our daily lives, we are always looking for shortcuts to save time and speed up our work. Shortcuts have very expensive values but free to use.

As like in general daily life, our working platforms also have shortcuts. Some of them provided by default while some of them created by us. Here I’m going to show you some of the shortcuts, that we used normally in Android Studio, provided by default and also show you how to create a shortcut in Android Studio. Let's get started.

Default Shortcuts:
- Double Shift: search any file from your project
- Ctrl+ [ : move the cursor to block/method end
- Ctrl+ ] : move the cursor to block/method start
- Ctrl + Shift + [ : move the cursor to block/method end with selection
- Ctrl + Shift + ] : move the cursor to block/method start with selection
- Ctrl + Y: delete the whole line
- Shift + PgUp : up with selection
- Shift + PgDn : down with selection
- Ctrl + D: duplicate line or duplicate selection
- Home: move the cursor to line start
- End: move the cursor to the line end
- Shift + Home: move the cursor to line start with selection
- Shift + End: move the cursor to line end with the selection
- Ctrl + C: to copy after selection or that line
- Ctrl + V: to paste
- Ctrl + Shift + V: showing last 5 copied content within IDE
- Ctrl + X: to cut after selection or that line
- Ctrl + Shift + PgUp: to move the line or code block up
- Ctrl + Shift + PgDn: to move the line or code block down
- Alt+ Left/Right arrow: to switch between files
- Ctrl + Shift + N: Go to file
- Ctrl + E: Showing recent files
- Ctrl + Alt + S: to open settings of the IDE
- Ctrl + Tab: to switch between recent files
- Ctrl + Alt + Home: Switch to XML from relevant activity/fragment layout and vice-versa
- Ctrl + F: find in the opened file
- Ctrl + Shift + F: find in project/module
- Ctrl + Shift + R: find and replace in project/module
- Ctrl + R: find and replace in the opened file
- Ctrl + U: navigate to its super method or class or interface
- Ctrl + O: get override members/methods
- Ctrl + G: go to specific line number
- Ctrl + H: view coding hierarchy
- Ctrl + B: view usage of the method
- Alt + F7: view usage of the file in the whole project
- Shift + F10: Run
- Ctrl + F10: Apply changes and restart activity
- Ctrl + Alt + F10: Apply code changes
- Ctrl + F9: Compile
- Shift + F9: Debug
- F8: Debug Step over
- F7: Debug step into
- Ctrl + T: Update project over git
- Ctrl + K: Commit project over git
- Ctrl + Shift + K: Push commits over git
- Ctrl + Alt + A: Adding files to VCS
- Ctrl + / : Comment line
- Ctrl + Shift + / : comment code block after selection
- Ctrl + Shift + E: Recent locations
- Ctrl + Shift + F8: View breakpoints
- Alt + 1: Project View window
- Alt + 2: Favorites window
- Alt + 3: Find window
- Alt + 6: Logcat window
- Alt + 7: Structure window
- Alt + 8: Services window
- Alt + 9: Version control window
- Ctrl + Alt + B: navigate to method implementation
- Ctrl-plus / Ctrl-minus: Zoom-in, zoom-out in layout
- Ctrl + 0 (zero): Fit to screen layout
- B: Switch layout (design or blueprint)
- O: Switch layout orientation (landscape or portrait)
- D: Switch layout device
- Alt + Ins: Generate code (getter/setter, constructor etc.)
- Ctrl + I: Implement methods (if any interface linked)
- Ctrl + Alt + T: Surround with (if..else, block, try..catch..finally, region, editor)
- Ctrl + Alt + O (letter O): Optimize imports (remove unused imports)
- Ctrl + Alt + L: Reformat code

These are the default android studio shortcuts, provided by IDE. Now I’m going to show you how to create a shortcut in android studio and my own shortcuts that I used on regular basis. Create a shortcut in the android studio is very much easy.

First, go to settings (Ctrl + Alt+ S) and go to keymap

Now in the search bar, type any command for what you want to create a shortcut. Here I want to create a shortcut for creating a new project. So I type a new project in the search bar.

We know, in which menu there is an option for creating a new project. So just confirm your selection before creating a shortcut. I selected New Project under Main Menu-File-New

Right-click on that option.
You can see 3 options: keyboard shortcut, mouse shortcut or abbreviation

Now click on keyboard shortcut, will show pop-up as below:

Type any keyboard shortcut that you want to add. I added Ctrl + Shift + N for this.

Notice one thing here, if the shortcut you want to add for your command is assigned to any other command, will show you warning like: Already assigned to: So it will create conflict while using that shortcut. You can keep both shortcuts or replace with existing one. But I would suggest to keep any one. So either replace with existing one or choose another shortcut which is not assigned any other command.
Than OK and apply. That’s it.
Now when I type Ctrl + Shift + N, it will show a new project window.

Let’s move to mouse shortcut. Mouse shortcuts have very fewer ways as the mouse has 2 clicks and one wheel. But Android Studio provides us with some advance options to add mouse shortcut. Here it is.

You can use mouse clicks, double-clicks, scroll mouse wheel with Ctrl, Shift and Alt from the keyboard. I want to add 2-times right click of the mouse to add a shortcut for creating a new project.

Cosider mouse left click as Button1, scroll wheel click as Button2 and right click as Button3.

That’s it. Mouse shortcut to create a new project is added with right-click 2 times.

Now let’s move to the abbreviation. An abbreviation is a shortcut, we can use them by double-shift and enter anything. It will ask you to enter a new abbreviation. Let me show you.

I entered newp as an abbreviation. That means whenever I use double shift and type “newp”, it will show me an option for creating a new project. See below image:

So press double-shift and enter your abbreviation, that will show your command first.

My own shortcuts
- Ctrl + W: Close current window
- Ctrl + Shift + W: close all windows
- Ctrl + Shift + O: close other windows except current
- Ctrl + Shift + C: clean project
- Ctrl + Shift + B: rebuild project
- Ctrl + Shift + S: Sync project
- “apk” abbreviation for generating signed APK
- Alt + Shift + E: Files are shown in explorer
- Ctrl + Shift + N: Create a new project
- Alt + Shift + N: Create new empty activity
- Alt + Shift + R: Invalid cache/restart
- Alt + Shift + V: Select build variant
- Alt + 2: Resource Manager
- Alt + Numpad Minus : Navigation Back
- Alt + Numpad Plus : Navigation forward

You can use one keyboard shortcut, one mouse shortcut and one abbreviation shortcut for each command. Like you can use Ctrl + Shift + N, mouse double right-click and “newp” all the 3 shortcuts for creating a new project.

That’s it. Hope you will try shortcuts but never try below shortcut 😄

--

--