File --> Settings... --> Editor --> General --> Auto Import --> 勾选"Optimize imports on the fly(for current project)"