I was thinking of building an app on android with Scala instead of the regular Java (or the equivalent I guess). Is it worth it? Any problems and unnecessary headaches?
views:
232answers:
3I have been trying to use Scala for Android, but couldn't found appropriate IDE. That was main issue. Existing NetBeans scala plugin is too buggy.
Working with Scala should be mostly painless, as the dex compiler just works with bytecode - which is exactly what Scala produces.
Your biggest problem then is the dependency on scala-library, as dex expects everything to be in a single Jar. This is best handled with Proguard (which will also remove unused code and give you a smaller executable, ideal for mobile)
Current best practice is to use SBT with the Android plugin; It'll take care of everything for you: http://github.com/jberkel/android-plugin
If you must use Eclipse and the plugin supplied by Google, then you're going to have a non-standard directory structure. I also wrote an article on how to deal with this: http://www.assembla.com/wiki/show/scala-ide/Developing_for_Android
But be warned... it takes a lot more effort that way!
We discussed this at Scala Lift Off London last Friday and the consensus seemed to be that it generally works fine as long as you avoid Actors. Also, the sbt-android-plugin was highly recommended. Nathan Hamblen's blog has many posts on Android and the ones also tagged Scala have a lot of gotchas worth looking out for.