Android Studio: Reformat Code Options
June 6, 2020
By default, Option+Cmd+L in Android Studio on a Mac is used to reformat code to comply with settings such as spacing/indentation, etc. Often you’d also want it to remove unused imports. To do so, open Reformat Code dialog by double-tapping on the Shift button and add a checkmark for the Optimize imports option.
Now every time you use Option+Cmd+L to format a file, unused imports will also be deleted!
If you’d like to reformat all files in a project at once, select Project (top-level) in Project view
Now press Option+Cmd+L to be presented with a Reformat Code dialog. Hit Run and all source files in the project will be reformatted.