looks like you are using 2.4.x with Scala 2.12. It might be compatibility issue.
Spark documentation reference:-
Spark runs on Java 8+, Python 2.7+/3.4+ and R 3.1+. For the Scala API, Spark 2.4.0 uses Scala 2.11. You will need to use a compatible Scala version (2.11.x).