⌥+⌃AltPlusCtrl

How to Rename a Symbol in Android Studio (Shift+F6)

Windows: Shift+F6
Mac: Shift+F6
Linux: Shift+F6
Shift+F6 renames the symbol currently under your cursor — a class, method, variable, or resource ID — updating each genuine usage of it everywhere the reference actually appears across the whole project, well beyond just the file you happen to be in, using semantic code understanding rather than blind text replacement. **Why this is safer than manual find-and-replace**: a simple text-based find-and-replace for a common name like 'name' or 'data' risks changing unrelated matches that happen to share the same text but refer to a completely different variable or field elsewhere in the codebase. Rename instead understands the actual code structure, correctly distinguishing your specific target symbol from unrelated same-named identifiers in different scopes. **Preview before committing**: Rename typically shows a preview of every location about to change before finalizing, letting you review the full scope of the rename's impact and back out if it affects more (or different) code than expected, rather than committing the change blindly. **Renaming across file types**: for Android-specific resources like layout files, drawable assets, or string resource IDs referenced both in XML and Kotlin/Java code, Rename correctly updates references across both the XML and code files simultaneously, which a code-only refactoring tool wouldn't handle since it wouldn't understand the XML resource-reference syntax. **A caution around external code**: Rename only safely updates references within your own project's understood codebase — if a symbol is part of a public API consumed by external code outside the current project (a library you publish, for instance), renaming it internally doesn't update those external consumers, potentially breaking their build until they update to match your new name. **Related shortcuts**: Alt+F7 (Option+F7) for Find Usages, worth running before a rename on a widely-used symbol to review its full usage scope, and Ctrl+Alt+L (Cmd+Option+L) for reformatting code, often run as a final cleanup pass after a series of refactoring changes. **Renaming a file versus renaming a symbol inside it**: Shift+F6 works both on code symbols (classes, methods, fields) and on files themselves when a file is selected in the Project view rather than a symbol in the editor — renaming a Kotlin or Java file this way also correctly updates the class name declared inside it and every reference to that class throughout the project, keeping the file name and class name in sync automatically. **Renaming XML resource IDs**: applying Rename to a view's ID attribute in a layout XML file updates every reference to that ID both within XML (in other layout files that might reference it) and within Kotlin/Java code (anywhere findViewById or a generated binding reference uses it), which a manual text-based find-and-replace would risk missing in one direction or the other. **When Rename declines to proceed automatically**: if the refactor engine detects a potential naming conflict — renaming to a name that already exists in the same scope, for instance — it warns you before completing the operation rather than silently creating an ambiguous or broken result, giving you a chance to choose a different name instead. Rebuilding this fluency across a career of Android projects pays off every time a codebase needs restructuring.

Related shortcuts