Android Studio rename attribute or method not always working

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.


I suspect that you've missed the refactor preview window that shows up when AS finds some code that it doesn't know if it should be refactored or not. For example, if the method being modified is referenced in comments, then AS will ask if you want to refactor those comment as well.

enter image description here


using a shortcut for "Rename" Variable Shift + F6

or

Select Variable/Method name -> Right Click in java file -> Refactor -> Rename