This problem happens intermittently for different libraries and different projects.
When trying to import a library, the package will be recognized, but the class name can\'
file-> Project Structure -> Modules, find the module with problems, click it and choose the Dependencies tab in the right side. Click the green plus sign, try to add the jar or libraries that cause the problem. That works for me.