spark-streaming-twitter uses Twitter4j. getLang() is only supported since version 3.0.6 of Twitter4J. If you are using a version 1.5.2 (or lower) of spark-streaming-twitter you won't be able to call getLang() because it uses version 3.0.3 of twitter4j. Since 1.6.0 version 4.0.4 is supported as wel as the getLang() function.

So you could upgrade spark-streaming-twitter to 1.6.0 or higher. Or you could use another 3rd party library to detect the language of your tweets.