46

Is there a way to change name of a file in Android Studio projects? I come from Visual Studio and tried to select-change name of file. I already tried to F2 thats keyboard shortcut.

1
  • Only the fact that Android Studio is special, so people must ask on StackOverflow how to do the simplest tasks, is somewhat ridiculous. Jan 30, 2021 at 20:00

4 Answers 4

81
  • Select file in project explorer and press -> Shift + F6

  • Select file with right click + Refactor -> Rename

2
  • 1
    You can change Keymap to eclipse in android studio. so you can use eclipse shortcut too.
    – Shvet
    May 14, 2015 at 4:06
  • @AhmetArslan Hey, you are right. How strange. I wonder if it's an updated version or I didn't do it correctly last time. I'll remove the comment to avoid confusion.
    – David
    Oct 12, 2015 at 10:42
12

Find the file in the Project window:

Right-click >> Refactor >> Rename File

3
  • 3
    What's the difference between Rename File to Rename?
    – God
    May 14, 2016 at 13:31
  • Any idea what is the difference. Jan 5, 2017 at 11:56
  • 1
    I believe Rename searches for more usages including comments/strings, variables, text, and occurrences in tests while Rename File just searches for references and comments/strings
    – Ryan
    Jan 10, 2017 at 19:05
1

If you have configure keymap as per "eclipse's keymap" than it will work.For change keymap , press Alt + Ctrl + S and change keymap from default to Eclipse Copy

Then below keys will work in android-studio :

1. Select particular file 
2. Press Alt + Shift + R

Now rename your file name.

2
  • Alt + Shift + R is shortcut for Eclipse, Android Studio is now based on IntelliJ with Shift - F6 for rename refactor May 14, 2015 at 3:09
  • If you have configure keymap as per "eclipse's keymap" than it will work.For change keymap , press Alt + Ctrl + S and change keymap from default to Eclipse Copy . May 15, 2015 at 4:52
0

Sometimes refactoring variables with refactor rename don't works in code. Then we can use Ctrl+Shift+R (on PCs) or Cmd+Shift+R (On Macs)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.