2011-09-26 102 views
10

我只是跟着在Build Scala Android apps using Scala的步驟,當我跑sbt我得到了以下未解決的相關性錯誤的項目文件夾內:未解決的依賴於sbt-android-plugin 0.6.0-SNAPSHOT?

[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? 

我缺少什麼?

回答

8

對於SBT 0.11.0:

  1. 遵照說明從@Debilski's answer到Android的插件發佈到本地。
  2. rm -rvf project/plugins/
  3. 創建一個文件project/plugins.sbt,這個文件的內容是addSbtPlugin("org.scala-tools.sbt" % "sbt-android-plugin" % "0.6.0-SNAPSHOT")
  4. 現在,你應該能夠運行sbt該項目
  5. android:package-debug下編譯/包創建的Hello World程序G8。
  6. android:install-device在Android設備上安裝APK。
+0

酷,這個工作。你能解釋發生了什麼嗎? – Macarse

+0

@Macarse在事實,我不知道發生了什麼究竟,我不是很熟悉SBT 0.1倍。我只是在位置,從發佈本地的不同在步驟1中發佈爲Android的plugin.jar項目搜索,以便我在SBT公文尋找另一種方式包括在項目中的插件錯誤信息中發現,和發現這一個作品。這就是所有,只是線索和錯誤,不知道爲什麼。 –

+0

感謝您的回答。 – Macarse

3

sbt-android-plugin尚未在版本0.6.0-SNAPSHOT中公開。一個快速解決方案是將其安裝在本地。

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

當然,這只是只要可以作爲GitHub的存儲庫的主分支點0.6.0-SNAPSHOT版本。 (如果沒有了,那麼我會懷疑0.6.0已經出版。)

+0

我這樣做,但我仍然得到同樣的問題。在android-plugin裏面,我寫'version',並且得到'[info] 0.6.0-SNAPSHOT'。 – Macarse

+0

也沒有爲我工作。在成功完成下列建議步驟之後,sbt android:package-debug仍會給出[error] {file:/ C:/ Workspaces/my-android-project/project/plugins /} default-949520/*:update:sbt.ResolveException:unresolved依賴性:org.scala-tools.sbt#SBT-Android的plugin_2.9.1; 0.6.0-快照:未發現 –

+3

插件被添加在SBT 0.11已changhed的方式。現在使用'g8 jberkel/android-app -b sbt-0_11'來初始化你的項目。 –