sublime-ensime for scala找不到android包

时间:2012-12-17 16:51:03

标签: android scala sbt sublimetext2 ensime

Ensime没有找到Android软件包,并且出现错误,例如:

object android is not a member of package <root>

我在OS X上使用sbt和sublime-ensime与Java 1.6试用一个简单的android演示项目。我知道一些类似的问题for example thisthis,但这些问题的解决方案对我没用。

项目是从模板中创建的,如下所示:

g8 jberkel/android-app

我使用

生成了.ensime文件(如下)
ensime generate

尽管显然列出了所有项目依赖项,但是ensime仍然无法找到android类。但是,sbt编译项目没有问题。

这是一个有点冗长的.ensime文件 - 我也尝试将其剥离到基础,但没有成功。

(:subprojects
((:runtime-deps
("/usr/local/android-sdk/platforms/android-14/android.jar"
"/Users/george/.sbt/boot/scala-2.10.0-RC2/lib/scala-library.jar"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/classes"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/classes")
:module-name
"android-essentials"
:compile-deps
("/usr/local/android-sdk/platforms/android-14/android.jar"
"/Users/george/.sbt/boot/scala-2.10.0-RC2/lib/scala-library.jar")
:version
"0.1"
:test-target
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/test-classes"
:name
"Android Essentials"
:depends-on-modules
()
:package
"android-essentials"
:target
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/classes"
:source-roots
("/Users/george/Source/Projects/android-essentials/src/main/scala"
"/Users/george/Source/Projects/android-essentials/src/main/java"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/src_managed/main/java"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/src_managed/main/scala"
"/Users/george/Source/Projects/android-essentials/src/test/scala"
"/Users/george/Source/Projects/android-essentials/src/test/java"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/src_managed/test")
:test-deps
("/usr/local/android-sdk/platforms/android-14/android.jar"
"/Users/george/.sbt/boot/scala-2.10.0-RC2/lib/scala-library.jar"
"/Users/george/.ivy2/cache/org.scalatest/scalatest_2.10.0-RC5/jars/scalatest_2.10.0-RC5-2.0.M5-B1.jar"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/classes"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/test-classes"))
(:runtime-deps
("/usr/local/android-sdk/platforms/android-14/android.jar"
"/Users/george/.sbt/boot/scala-2.10.0-RC2/lib/scala-library.jar"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/classes"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/classes"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/classes")
:module-name
"android-essentials-tests"
:compile-deps
("/usr/local/android-sdk/platforms/android-14/android.jar"
"/Users/george/.sbt/boot/scala-2.10.0-RC2/lib/scala-library.jar"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/classes")
:version
"0.1"
:test-target
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/test-classes"
:name
"Android Essentials Tests"
:depends-on-modules
("android-essentials")
:package
"android-essentials-tests"
:target
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/classes"
:source-roots
("/Users/george/Source/Projects/android-essentials/tests/src/main/scala"
"/Users/george/Source/Projects/android-essentials/tests/src/main/java"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/src_managed/main/java"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/src_managed/main/scala"
"/Users/george/Source/Projects/android-essentials/tests/src/test/scala"
"/Users/george/Source/Projects/android-essentials/tests/src/test/java"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/src_managed/test")
:test-deps
("/usr/local/android-sdk/platforms/android-14/android.jar"
"/Users/george/.sbt/boot/scala-2.10.0-RC2/lib/scala-library.jar"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/classes"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/classes"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/test-classes"))))

Here is the relevant part of the ensime server.log

我的配置有问题,或者Ensime / Sublime有什么问题吗?

1 个答案:

答案 0 :(得分:1)

似乎这个问题与ensime如何使用sbt ensime-sbt-cmd插件生成的.ensime文件有关。

我通过重构我的.ensime文件解决了这个问题,因此它没有任何子项目。

例如,我上面的原始.ensime文件现在看起来像这样:

(:name
"Android Essentials"
:module-name
"android-essentials"
:version
"0.1"
:package
"droid.essentials"
:runtime-deps
("/usr/local/android-sdk/platforms/android-14/android.jar"
"/Users/george/.sbt/boot/scala-2.10.0-RC2/lib/scala-library.jar"
"/Users/george/.sbt/boot/scala-2.10.0-RC2/lib/scala-reflect.jar"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/classes"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/classes"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/classes"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/classes"
"/Users/george/.ivy2/cache/com.google.android/support-v4/jars/support-v4-r7.jar"
"/Users/george/.ivy2/cache/io.spray/spray-json_2.10.0-RC5/jars/spray-json_2.10.0-RC5-1.2.3.jar")
:compile-deps
("/usr/local/android-sdk/platforms/android-14/android.jar"
"/Users/george/.sbt/boot/scala-2.10.0-RC2/lib/scala-library.jar"
"/Users/george/.sbt/boot/scala-2.10.0-RC2/lib/scala-reflect.jar"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/classes"
"/Users/george/.ivy2/cache/com.google.android/support-v4/jars/support-v4-r7.jar"
"/Users/george/.ivy2/cache/io.spray/spray-json_2.10.0-RC5/jars/spray-json_2.10.0-RC5-1.2.3.jar")
:target
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/classes"
:test-target
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/test-classes"
:source-roots
("/Users/george/Source/Projects/android-essentials/src/main/scala"
"/Users/george/Source/Projects/android-essentials/src/main/java"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/src_managed/main/java"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/src_managed/main/scala"
"/Users/george/Source/Projects/android-essentials/src/test/scala"
"/Users/george/Source/Projects/android-essentials/src/test/java"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/src_managed/test"
"/Users/george/Source/Projects/android-essentials/tests/src/main/scala"
"/Users/george/Source/Projects/android-essentials/tests/src/main/java"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/src_managed/main/java"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/src_managed/main/scala"
"/Users/george/Source/Projects/android-essentials/tests/src/test/scala"
"/Users/george/Source/Projects/android-essentials/tests/src/test/java"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/src_managed/test")
:test-deps
("/usr/local/android-sdk/platforms/android-14/android.jar"
"/Users/george/.ivy2/cache/com.google.android/support-v4/jars/support-v4-r7.jar"
"/Users/george/.ivy2/cache/io.spray/spray-json_2.10.0-RC5/jars/spray-json_2.10.0-RC5-1.2.3.jar" 
"/Users/george/.sbt/boot/scala-2.10.0-RC2/lib/scala-library.jar"
"/Users/george/.sbt/boot/scala-2.10.0-RC2/lib/scala-reflect.jar"
"/Users/george/.ivy2/cache/org.scalatest/scalatest_2.10.0-RC5/jars/scalatest_2.10.0-RC5-2.0.M5-B1.jar"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/classes"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/test-classes"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/classes"
"/Users/george/Source/Projects/android-essentials/target/scala-2.10/classes"
"/Users/george/Source/Projects/android-essentials/tests/target/scala-2.10/test-classes"))

此问题正在进一步调查here