Ensime doesn't work with sbt + android-plugin

血红的双手。 提交于 2020-01-11 06:43:28

问题


i created a project by using this: https://github.com/gseitz/android-sbt-project.g8

When i start ensime in emacs to edit src/main/scala/Activity.scala i have red highlights almost everywhere. First highlight says by exemple in "import root.android.whatever" that android is not a member of root. But in sbt everything compile fine. How can i set ensime to work correctly with sbt + android-plugin ?


回答1:


Let Ensime know where it can find the android packages. Add a line to your .ensime file that contains the path to android.jar, for example:

:compile-jars (" [...] /local/share/java/android-sdk-mac_x86/platforms/android-10/android.jar")




回答2:


The previous answer no longer works with newer versions of ensime. The new version requires something like

:compile-deps ("/home/aij/android/sdk/platforms/android-21/android.jar" ...)

Here's a one-liner to edit the file for you, assuming $ANDROID_HOME is set:

sed -i~ 's|:compile-deps (|:compile-deps ("'"$ANDROID_HOME"'/platforms/android-21/android.jar" |' .ensime

Anyway, this is still just a kludgy hack to get it to work. The proper fix would be to fix one of the two plugins.



来源:https://stackoverflow.com/questions/5449175/ensime-doesnt-work-with-sbt-android-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!