Deleting .gradle and .idea will likely solve the problem.
So:
- Close the project
- Go to the project dir and delete
.gradleand.idea - Get back and re-open the project using the IDE
These two must be generated locally on your PC (Some content of .idea might be version controlled though) and not pulled from a remote or somewhere else (Also they should be in .gitignore).
In my case the reason was that these two folders were generated on another computer and I had opened a project with these two folders existing before.