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\'
Had the same problem till I noticed that the src folder was marked as root source instead of java!
Changing to only the java (src/main/java) to be the source root solved my problem