2

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

Incerteza
  • 32,326
  • 47
  • 154
  • 261
  • possible duplicate of [Why does sbt give "can't expand macros compiled by previous versions of Scala" for Def.inputTask macro in Scala 2.11.1?](http://stackoverflow.com/questions/24103043/why-does-sbt-give-cant-expand-macros-compiled-by-previous-versions-of-scala-f) – dk14 Jan 11 '15 at 15:17

1 Answers1

3

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
Community
  • 1
  • 1
dk14
  • 22,206
  • 4
  • 51
  • 88