第一种方法 步骤: File → Settings → Editor → General → Auto Import 勾中选项: √ Add unambiguous imports on the fly(动态添加明确的导入) √ Optimize imports on the fly(动态优化导入) 第二种方法 步骤: File → InvalidateCaches / Restart