androidscalasbtsbt-android-plugin

sbt-android: IntelliJ marks usages of android support resources red


I am using the sbt-android plugin to develop Android Applications with Scala and SBT.

I have written a little project from sample code, it runs great.

But IntelliJ marks all "pointers" to library resources red - so I can define them, but not use them.

It says, e.g. : 'cannot find symbol Theme.AppCompat'.

Here are some pictures:

Here is my build.sbt:

name := "Scalandroid"

import android.Keys._
import android.Dependencies.{apklib,aar}

androidBuild

javacOptions ++= Seq("-source", "1.7", "-target", "1.7")

scalaVersion := "2.11.7"

resolvers += "Bugsense repository" at "http://www.bugsense.com/gradle/"

libraryDependencies ++= Seq(
  aar("com.android.support" %  "appcompat-v7" % "24.2.0"),
  aar("com.android.support" %  "cardview-v7" % "24.2.0"),
  aar("com.android.support" % "support-v4" % "24.2.0"),
  aar("com.android.support" % "design" % "24.2.0"),
  aar("com.android.support" % "recyclerview-v7" % "24.2.0")
)

scalacOptions in Compile += "-feature"

compileOrder := CompileOrder.JavaThenScala

compileOrder in Android := CompileOrder.JavaThenScala

proguardOptions in Android ++= Seq("-dontobfuscate", "-dontoptimize",  "-      keepattributes Signature", "-printseeds target/seeds.txt", "- printusage    target/usage.txt"
   , "-dontwarn scala.collection.**" // required from Scala 2.11.4
)


run <<= run in Android
install <<= install in Android

proguardScala in Android := true

useProguard in Android := true


// Tests //////////////////////////////

libraryDependencies ++= Seq(
  "org.apache.maven" % "maven-ant-tasks" % "2.1.3" % "test",
  "org.robolectric" % "robolectric" % "3.0" % "test",
  "junit" % "junit" % "4.12" % "test",
  "com.novocode" % "junit-interface" % "0.11" % "test"
)

// without this, @Config throws an exception,
unmanagedClasspath in Test ++= (bootClasspath in Android).value

and here is my project/plugins.sbt:

addSbtPlugin("org.scala-android" % "sbt-android" % "1.6.16")
addSbtPlugin("org.scala-android" % "sbt-android-protify" % "1.3.2")

libraryDependencies += "net.sf.proguard" % "proguard-base" % "5.2.1"

Solution

  • It is a known issue in Intellij

    You can either switch to the nightly scala plugin in IDEA or download this file and replace your local copy