1.快捷鍵
Ctrl+Alt+O
2.點(diǎn)擊項(xiàng)目右鍵,點(diǎn)擊Optimize Imports
3.通過(guò)設(shè)置郑藏,可以在編碼過(guò)程中自行刪除多余的import,無(wú)需手動(dòng)(Do it on the fly)
在下面的位置打?qū)?br> File->Settings->Editor->Auto Import->Optimize Imports on the fly
參考文獻(xiàn)
remove-unused-imports-in-android-studio@StackOverFlow