How to build Android project with Scala sources in IntelliJ IDEA (Community Edition)?
I am trying to build an Android project with Scala sources in IntelliJ IDEA (Community Edition). I am using Scala sources from Java files: auto-complete works correctly, but build cannot resolve Scala classes in Java: cannot find symbol class MyScalaClass
.
(I managed that in Eclipse, but Scala support in Eclipse is poor.)
Any hints or tutorials?
Update: I have added Scala module in addition to Android module. Now, build fails during generating classes.dex
with message:
Error: trouble writing output: format == null
I found that it is a limitation of Dalvik: issue 7147.
How can I strip unused methods/classes in IDEA without using Ant script? (I was using ProGuard in Ant script, but I was unable make IDEA to parse Scal开发者_运维知识库a error messages from Ant results.)
The scala/java system requires that you:
- Build scala first, giving the compiler both scala and java files.
- Build the java sources with the compiled scala classes in the path for javac.
The second is probably what you lack. Refer to how to add directory to classpath in an application run profile in intellij idea? to add a classpath to Intellij (I suppose you did it for the android runtime, so you probably already know it).
You should use ProGuard to strip down unused classes.
Follow the instructions here (Specifically take a look at the progaurd-project.txt
:
https://github.com/yareally/android-scala-intellij-no-sbt-plugin
精彩评论