0

Ensime 没有找到 android 包并给出如下错误:

object android is not a member of package <root>

我在带有 Java 1.6 的 OS X 上使用 sbt 和 sublime-ensime 来尝试一个简单的 android 演示项目。我知道一些类似的问题,例如 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"))))

这是 ensime server.log 的相关部分

我的配置有问题,还是 Ensime / Sublime 有问题?

4

1 回答 1

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"))

这个问题正在这里进一步调查。

于 2013-01-24T18:38:47.400 回答