How to get IntelliJ IDEA 14 working with Scala on

2019-07-23 19:36发布

问题:

I'm using android-sdk-plugin to make Android apps with Scala using SBT. This generally works great - however when trying to import the project into IntelliJ IDEA 14.1 the imported project looks rather empty and does not recognize my source files as being part of the project.

The documentation says:

IntelliJ 14 now includes native support for importing projects from android-sdk-plugin. The process generally works well, however there are still several caveats: The idea-sbt-plugin is still required to actually perform the build (no longer necessary as of IDEA 14.1)

Cloning and importing even the simplest example project results in an empty IDE not showing any sources at all:

I have installed both the Scala plug-in and the SBT plug-in (which I believe should no longer be required) as requested by the documentation.

What essential step am I missing?

Edit: I added the plug-in manually to project/plugins.sbt, then ran gen-android to get a project/build.scala containing object Build extends android.AutoBuild.

回答1:

The essential step missing is the Android plug-in of IDEA. This might seem obvious but in contrast to plug-ins for other frameworks this one does not just provide extra goodies but is actually essential for anything Android.

Having the plug-in installed allows for selecting Android as a Project SDK (which not just selects an Android SDK but also a Java SDK to go with it).