10

I just followed the steps at Build Scala Android apps using Scala and when I ran sbt inside the project folder I got the following unresolved dependency error:

[info] Loading project definition from /Users/macarse/Documents/scalatest/project/plugins
[info] Updating {file:/Users/macarse/Documents/scalatest/project/plugins/}default-dd299a...
[warn]  module not found: org.scala-tools.sbt#sbt-android-plugin_2.9.1;0.6.0-SNAPSHOT
[warn] ==== typesafe-ivy-releases: tried
[warn]   http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt-android-plugin_2.9.1/0.6.0-SNAPSHOT/ivys/ivy.xml
[warn]   -- artifact org.scala-tools.sbt#sbt-android-plugin_2.9.1;0.6.0-SNAPSHOT!sbt-android-plugin_2.9.1.jar:
[warn]   http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt-android-plugin_2.9.1/0.6.0-SNAPSHOT/jars/sbt-android-plugin_2.9.1.jar
[warn] ==== local: tried
[warn]   /Users/macarse/.ivy2/local/org.scala-tools.sbt/sbt-android-plugin_2.9.1/0.6.0-SNAPSHOT/ivys/ivy.xml
[warn]   -- artifact org.scala-tools.sbt#sbt-android-plugin_2.9.1;0.6.0-SNAPSHOT!sbt-android-plugin_2.9.1.jar:
[warn]   /Users/macarse/.ivy2/local/org.scala-tools.sbt/sbt-android-plugin_2.9.1/0.6.0-SNAPSHOT/jars/sbt-android-plugin_2.9.1.jar
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/scala-tools/sbt/sbt-android-plugin_2.9.1/0.6.0-SNAPSHOT/sbt-android-plugin_2.9.1-0.6.0-SNAPSHOT.pom
[warn]   -- artifact org.scala-tools.sbt#sbt-android-plugin_2.9.1;0.6.0-SNAPSHOT!sbt-android-plugin_2.9.1.jar:
[warn]   http://repo1.maven.org/maven2/org/scala-tools/sbt/sbt-android-plugin_2.9.1/0.6.0-SNAPSHOT/sbt-android-plugin_2.9.1-0.6.0-SNAPSHOT.jar
[warn] ==== Scala-Tools Maven2 Repository: tried
[warn]   http://scala-tools.org/repo-releases/org/scala-tools/sbt/sbt-android-plugin_2.9.1/0.6.0-SNAPSHOT/sbt-android-plugin_2.9.1-0.6.0-SNAPSHOT.pom
[warn]   -- artifact org.scala-tools.sbt#sbt-android-plugin_2.9.1;0.6.0-SNAPSHOT!sbt-android-plugin_2.9.1.jar:
[warn]   http://scala-tools.org/repo-releases/org/scala-tools/sbt/sbt-android-plugin_2.9.1/0.6.0-SNAPSHOT/sbt-android-plugin_2.9.1-0.6.0-SNAPSHOT.jar
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.scala-tools.sbt#sbt-android-plugin_2.9.1;0.6.0-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/Users/macarse/Documents/scalatest/project/plugins/}default-dd299a/*:update: sbt.ResolveException: unresolved dependency: org.scala-tools.sbt#sbt-android-plugin_2.9.1;0.6.0-SNAPSHOT: not found
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? 

What am I missing?

Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
Macarse
  • 91,829
  • 44
  • 175
  • 230

2 Answers2

8

For sbt 0.11.0:

  1. Follow instructions from @Debilski's answer to publish android-plugin to local.
  2. rm -rvf project/plugins/
  3. Create a file project/plugins.sbt, the content of this file is addSbtPlugin("org.scala-tools.sbt" % "sbt-android-plugin" % "0.6.0-SNAPSHOT")
  4. Now you should be able to run sbt under that project
  5. android:package-debug to compile/package the hello world program g8 created.
  6. android:install-device to install the APK on the android device.
Community
  • 1
  • 1
Brian Hsu
  • 8,781
  • 3
  • 47
  • 59
  • @Macarse In facts I don't know what happened exactly, I'm not quite familiar with SBT 0.1x. I just found in error message that the project searches for android-plugin.jar in location that different from publish-local publish to in the step 1. So I search on the SBT official document for another way to include a plugin in project, and found this one works. That's all, just trail and error and have no idea why. – Brian Hsu Sep 27 '11 at 22:21
3

sbt-android-plugin has not been made public in version 0.6.0-SNAPSHOT. A quick fix would be to install it locally.

git clone https://github.com/jberkel/android-plugin.git 
cd android-plugin
sbt update
sbt publish-local

Of course, this works only as long as the github repository’s master branch points to version 0.6.0-SNAPSHOT. (If it doesn’t anymore, then I may suspect that 0.6.0 has been published.)

Debilski
  • 66,976
  • 12
  • 110
  • 133
  • I did that but I am still getting the same issue. Inside android-plugin I write `version` and I get `[info] 0.6.0-SNAPSHOT`. – Macarse Sep 27 '11 at 13:26
  • Didn't work for me either. After following suggested steps successfully, sbt android:package-debug still gives [error] {file:/C:/Workspaces/my-android-project/project/plugins/}default-949520/*:update: sbt.ResolveException: unresolved dependency: org.scala-tools.sbt#sbt-android-plugin_2.9.1;0.6.0-SNAPSHOT: not found – Jeff Axelrod Sep 28 '11 at 15:35
  • 3
    the way plugins get added has changhed in sbt 0.11. for now use `g8 jberkel/android-app -b sbt-0_11` to initialise your project. – Jan Berkel Sep 28 '11 at 16:57
  • 2
    To clarify @JanBerkel's comment, you still need to do the publish local as described here and then create your project with g8 jberkel/android-app -b sbt-0_11 – Jeff Axelrod Oct 11 '11 at 16:23