title: IntelliJ gives errors saying "Cannot resolve symbol " in build.sbt after creating Scala project
body: <p>On creating a Scala project in IntelliJ, the build.sbt file shows error &quot;Cannot resolve symbol name&quot;. When I created a &quot;Hello World&quot; Scala Object, in spite of the error in sbt file, the program ran successfully.</p>
  <p>When I added a dependency in the build.sbt for Spark core, it showed &quot;Cannot resolve symbol libraryDependencies&quot;, and in the Scala Object, when I added an import for SparkContext <code>import org.apache.spark.SparkContext</code>, it gave &quot;Cannot resolve symbol apache&quot;.</p>
  <p>I went through the below related post:</p>
  <p><a href="https://stackoverflow.com/questions/5905896/intellij-inspection-gives-cannot-resolve-symbol-but-still-compiles-code">IntelliJ inspection gives &quot;Cannot resolve symbol&quot; but still compiles code</a></p>
  <p>and attempted &quot;Invalidate Cache&quot; but it did not resolve the issue.</p>
  <p>I also tried deleting the IDEA directory and reimporting the project as below:</p>
  <ol>
  <li>Closed IntelliJ.</li>
  <li>Went to the project folder and delete the .idea directory.</li>
  <li>Opened IntelliJ.</li>
  <li>Imported the project again by clicking on File&gt;&gt;New&gt;&gt;Project from existing sources.</li>
  </ol>
  <p>However, this too did not resolve the issue.</p>
  <p>Also, I tried using a lower version of Scala which did not resolve the issue.</p>
  <p>Below are the contents of the build.sbt file:</p>
  <pre><code>name := &quot;ScalaApp&quot;
  version := &quot;0.1&quot;
  scalaVersion := &quot;2.12.12&quot;
  libraryDependencies += &quot;org.apache.spark&quot; %% &quot;spark-core&quot; % &quot;2.4.3&quot;
  </code></pre>
  <p>What can be the issue that it shows these errors in build.sbt and despite that the Scala hello world runs fine but not when I add another dependency in build.sbt and include import in the Scala class?</p>
  <p>Thanks</p>