Fixing the Scala error: java.lang.NoSuchMethodError: scala.Product.$init$

As a note to self, when you see a Scala error message that looks like this:

java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V

it probably means that you have a mismatch in the Scala versions you’re using in your project. For instance, I just tried to use a library I compiled with Scala 2.12 with Spark, which was compiled with Scala 2.11, and I got that error message. In this case I was able to resolve the problem by recompiling my library with Scala 2.11.