问题
I'm converting a project to Scala 2.11.4 and sbt 0.13.7. I got a lot of errors, some of them are:
can't expand macros compiled by previous versions of Scala
[error] preloadDevice <<= preloadDeviceTask
for this code:
lazy val settings: Seq[Setting[_]] = inConfig(Android) (Seq(
// Preload Scala on the device/emulator
preloadDevice <<= preloadDeviceTask,
preloadEmulator <<= InputTask(
(sdkPath)(AndroidProject.installedAvds(_)))(preloadEmulatorTask),
// Uninstall previously preloaded Scala
unloadDevice <<= unloadDeviceTask,
unloadEmulator <<= InputTask(
(sdkPath)(AndroidProject.installedAvds(_)))(unloadEmulatorTask)
))
How do I fix it?
UPDATE:
JDK 8
回答1:
From here: Why doesn't the Def.inputTask macro work in Scala 2.11.1?
In your build.sbt file, make sure you scalaVersion := "2.10.4" instead of something like scalaVersion := "2.11.x"
If you use JDK 8, there is not too much options as Sbt 0.13.x compiled against Scala 2.10.x:
- use JDK7 for sbt only (by setting specific JAVA_HOME for sbt in your run-script) - your project will still be compiled against JDK8
- try JDK8 + Scala-2.10 for sbt (it may work but no guarantees of course)
- build sbt 0.13 against JDK8 by yourself
来源:https://stackoverflow.com/questions/27888182/cant-expand-macros-compiled-by-previous-versions-of-scala-scala-2-11-4-sbt-0