Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio rename attribute or method not always working

In Android Studio, I sometimes have to rename some field, attribute or method name. I know I must select its name, then hit Alt+Shift+R. Then I type in the new name, and hit Enter.

However, sometimes it works, and sometimes... it just does nothing at all. The new name is just discarded and replaced with the old ones.

Can someone explain me why and how to force this very basic feature to work ?

like image 509
Orabîg Avatar asked Sep 06 '15 10:09

Orabîg


People also ask

How can I change variable name in all places in Android Studio?

If you're on Windows or Linux you should be able to rename all occurrences of your variable (variableAusgabe) by just using the Ctrl + Shift + R shortcut. When you use this, a pop-up shows up and you have to enter the text you want to replace (variableAusgabe), and the text you want to replace it with.

Can I change Android package name?

Step by Step Implementation Step 2: Now click on the setting gear icon and deselect Compact Middle Packages. Step 3: Now the packages folder is broken into parts as shown in the below image. Step 4: Now right-click on the first package name (com) and Refactor > Rename.


1 Answers

This also happens when using dagger and trying to refactor via Shift+f6. Android Studio hesitates when renaming things in generated code (which seems silly). Anyway, doing a project clean and then doing the rename works.

like image 190
Sava B. Avatar answered Sep 27 '22 21:09

Sava B.