I tried using sbt and maven for android-scala and I quite like maven for doing the whole release thing(ProGuard-ing the scala standar lib etc). But I want lightweight recompile cycle for development inside my IDE – IntelliJ IDEA.
The problem is scala files wont’t compile. I configured my project like this:
- created android project
- added scala facet
- set scala compiler to global
- added dependency on scala library(global) and set it to “provided”
I added a scala object and referenced it from java Activity. ClassNotFoundException and force close. It compiles cleanly(and quite quckly).
I created a plain old java project the same way and using same global libraries and it worked.
An inspection of the apk revealed it contained scala source(!) file. So apparently it didn’t event try to compile.
Oh, and my phone has scala preinstalled with scala installer from play store.
I use IntelliJ IDEA 11 community. I first tried this a few months ago and it worked.
update it works on a different machine.
You might have to fiddle with your “proguard.cfg” file.
Here’s the one I use from a project using Scala 2.10 and Android with the IntelliJ IDE (change the first option to match your package name):