0

Ensime が Android パッケージを見つけられず、次のようなエラーが発生します。

object android is not a member of package <root>

OS X で Java 1.6 を使用して 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

この問題は、sbt ensime-sbt-cmd プラグインによって生成される .ensime ファイルを 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 に答える