2

I'm sure this is not a difficult question to answer. I'm able to replace a specific word or regex expression within a file in Android Studio.

But, I can't seem to know how to do it project wide.

I'm clicking ctrl-R and click on replaceAll button, but it only changes within the current file.

Any idea how to do the same but in the entire project.

ChrisK0043
  • 91
  • 7

1 Answers1

5

Click CTRL+SHIFT+R

This will do a whole project, or folder, or scope replacement.

You can click on any folder on the left window, and do CTRL+SHIFT+R this will confine the replacement to that folder.

You can also do CTRL+SHIFT+F to do a global search without the replacement.

Android Studio is based on IntelliJ and shares all default shortcuts, if you can't find an AndroidStudio answer, its ok to search for Intellij also:

Find and Replace symbol for whole project intellij? https://stackoverflow.com/a/38444457/413127

Blundell
  • 75,855
  • 30
  • 208
  • 233
  • Thanks man.. now I can go and migrate to AndroidX faster @Blundell – ChrisK0043 Feb 15 '20 at 21:13
  • You know there's a menu option for that **Refactor > Migrate to AndroidX** https://developer.android.com/jetpack/androidx/migrate#migrate_an_existing_project_using_android_studio – Blundell Feb 15 '20 at 21:16
  • yes I know, but after trying that I still have to delete the old imports that reference the support library.. I'm manually changing them to the AndroidX equivalents. But I'm having trouble with androidx.leanback.preference.LeanbackPreferenceDialogFragment . Android studio is telling me is not found? any ideas? @Blundell – ChrisK0043 Feb 15 '20 at 21:55
  • docs say its deprecated, so might no longer be in the version you have. Try `LeanbackPreferenceDialogFragmentCompat` – Blundell Feb 15 '20 at 22:45