解决方法如下:
点击File-->选择Invalidate Caches / Restart...
点击Invalidate and Restart
等idea重启完成后,便可以看到红色下划线没有了,其中导入的包可以使用了。