Remove unused imports in Android Studio

It is very Simple Just Follow the below step.

  1. Switch your project in Project Mode.

enter image description here

  1. Then right-click on project name.
  2. The final step is to select the Optimize imports from popup menu.

Enjoy!!


You can do it on the fly. You don't need to call (Ctrl+Shift+O) or "Project/Optimize Imports..." each time.

Just set this checkbox in Settings -> Editor -> General -> Auto Import -> Optimize Imports on the fly.

enter image description here

On OSX: Preferences -> Editor -> General -> Auto Import -> Optimize imports on the fly


Simple, right click on your project in Android Studio, then click on the Optimize Imports that should work.

screenshot

Update

To do same thing which I described above, you can do same just pressing Ctrl+Alt+O, it will optimize imports of your current file and your entire project depends on your selection in a dialog.

enter image description here


Press Ctrl + Alt + O.

A dialog box will appear with a few options. You can choose to have the dialog box not appear again in the future if you wish, setting a default behavior.

enter image description here