IntelliJ IDEA "Cannot resolve symbol 'Xxxxx'" but builds modules successfully on a Gradle project


"Cannot resolve symbol 'Xxxxx'" on a Gradle project
  1. File > Invalidate Caches / Restart...
  2. Invalidate
  3. File > Close Project
  4. Remove the Gradle project from projects history
  5. Exit IntelliJ IDEA
  6. Remove "IntelliJ IDEA system" dir
    $ rm -rf ~/.IntelliJIdea201X.Y/system/
    
  7. Start IntelliJ IDEA again
  8. Import the Gradle project