Ensime + sbt: "Android SDK not found"



我试图使用Ensime与g8 (https://github.com/philcali/android-plugin)生成的android项目一起工作。在这个问题之后,我将android.jar添加到我的.ensime文件中。

(:project-package "org.test"
:use-sbt t
:compile-jars ("~/_dev/_android/android-sdk-linux_x86/platforms/android-8/android.jar"))

我也有一个导出的ANDROID_SDK_HOME变量在我的~/。bashrc文件(。但是当我试图启动ensime时,我得到了这个错误:

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)
我不明白为什么会发生这种事。有人对此有什么看法吗?谢谢。

解决方案找到了!答案在这里:https://github.com/aemoncannon/ensime/issues/184#issuecomment-2038002:

.bashrc中的环境变量只对程序有效运行或从bash启动,否则需要.profile。如果您正在使用emacs:您可以使用M-x getenv来查看emacs是否可以请参阅环境变量。使用(setv "ANDROID_SDK_HOME")"~/_dev/_android/android-sdk-linux_x86/")在.emacs中设置它每个emacs会话。但你可能已经知道了,所以我不知道看看这对你有没有帮助。Emacs有时似乎很棘手设置有关的环境变量。

感谢zilti!

相关内容

  • 没有找到相关文章