我正在尝试使用Ensime来处理使用g8(https://github.com/philcali/android-plugin)生成的adnroid项目。关注this question我将android.jar添加到我的.ensime文件中。这是它:
(:project-package "org.test"
:use-sbt t
:compile-jars ("~/_dev/_android/android-sdk-linux_x86/platforms/android-8/android.jar"))
我的〜/ .bashrc文件中还有一个导出的 ANDROID_SDK_HOME 变量。 但是,当我试图启动时,我得到了这个错误:
java.lang.RuntimeException: Android SDK not found. You might need to set ANDROID_SDK_HOME or ANDROID_SDK_ROOT or ANDROID_HOME
at scala.Predef$.error(Predef.scala:58)
at AndroidPath$$anonfun$settings$8$$anonfun$apply$1.apply(AndroidPath.scala:21)
at AndroidPath$$anonfun$settings$8$$anonfun$apply$1.apply(AndroidPath.scala:21)
at scala.Option.getOrElse(Option.scala:104)
at AndroidPath$$anonfun$settings$8.apply(AndroidPath.scala:21)
at AndroidPath$$anonfun$settings$8.apply(AndroidPath.scala:20)
at sbt.Scoped$Apply$$anonfun$single$1.apply(Structure.scala:444)
at sbt.Scoped$Apply$$anonfun$single$1.apply(Structure.scala:444)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:44)
at sbt.Init$Apply.get(Settings.scala:223)
at sbt.Init$class.sbt$Init$$applySetting(Settings.scala:144)
at sbt.Init$$anonfun$compile$1$$anonfun$3$$anonfun$apply$2.apply(Settings.scala:100)
at sbt.Init$$anonfun$compile$1$$anonfun$3$$anonfun$apply$2.apply(Settings.scala:100)
at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:123)
at scala.collection.immutable.List.foldLeft(List.scala:45)
at scala.collection.TraversableOnce$class.$div$colon(TraversableOnce.scala:139)
at scala.collection.immutable.List.$div$colon(List.scala:45)
at sbt.Init$$anonfun$compile$1$$anonfun$3.apply(Settings.scala:100)
at sbt.Init$$anonfun$compile$1$$anonfun$3.apply(Settings.scala:100)
at sbt.Init$$anonfun$sbt$Init$$applyInits$1.apply(Settings.scala:140)
at sbt.Init$$anonfun$sbt$Init$$applyInits$1.apply(Settings.scala:140)
at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:123)
at scala.collection.immutable.List.foldLeft(List.scala:45)
at scala.collection.TraversableOnce$class.$div$colon(TraversableOnce.scala:139)
at scala.collection.immutable.List.$div$colon(List.scala:45)
at sbt.Init$class.sbt$Init$$applyInits(Settings.scala:140)
at sbt.Init$class.make(Settings.scala:92)
at sbt.Project$.make(Project.scala:102)
at sbt.Project$$anonfun$makeSettings$1.apply(Project.scala:177)
at sbt.Project$$anonfun$makeSettings$1.apply(Project.scala:177)
at sbt.Project$.translateCyclic(Project.scala:218)
at sbt.Project$.makeSettings(Project.scala:177)
at sbt.Load$.apply(Load.scala:120)
at sbt.Load$.defaultLoad(Load.scala:36)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:371)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:368)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:61)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:61)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:63)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:63)
at sbt.Command$.process(Command.scala:91)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:66)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:66)
at sbt.State$$anon$1.process(State.scala:59)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:66)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:66)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:13)
at sbt.MainLoop$.next(Main.scala:66)
at sbt.MainLoop$.run(Main.scala:61)
at sbt.xMain.run(Main.scala:33)
at xsbt.boot.Launch$.run(Launch.scala:54)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:43)
at xsbt.boot.Launch$.launch(Launch.scala:68)
at xsbt.boot.Launch$.apply(Launch.scala:14)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
我无法理解它发生的原因。有没有人对此有所了解?感谢。
答案 0 :(得分:2)
找到解决方案!答案在这里:https://github.com/aemoncannon/ensime/issues/184#issuecomment-2038002:
.bashrc中的环境变量仅对程序有效 在bash中运行或从bash开始,否则你需要.profile。 如果您正在使用emacs:您可以使用M-x getenv来查看emacs是否可以 看环境变量。使用(setenv“ANDROID_SDK_HOME” 您的.emacs中的“〜/ _dev / _android / android-sdk-linux_x86 /”)将其设置为 每个emacs会话。但你可能已经知道了这一点,所以我没有 知道这是否有任何帮助。 Emacs有时似乎很棘手 建立有关环境变量。
感谢 zilti !