-
Open File -> Project Structures -> Libraries, remove any scala sdk in it, e.g. scala-sdk-2.11.8 in the following image.

-
Click on +, then Scala SDK.

-
Select the right Scala SDK from the list, for me, it’s Ivy-Scala-2.11.8 shown in the picture.

-
Select the current project(mine is
spark-test), click OK.

-
Then click OK to close it.

-
Run again, it should work now.