我想建设使用Scala,而不是常规的Java(或等值我猜)在Android上的应用程序中。这样做值得吗?
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?
使用Scala工作应该主要是无痛的,因为DEX编译器只适用于字节code - 而这正是Scala的产生
Working with Scala should be mostly painless, as the dex compiler just works with bytecode - which is exactly what Scala produces.
您最大的问题则是上阶库的依赖,因为DEX希望一切是在一个jar。这是最好的Proguard的(这也将删除未使用的code和给你一个更小的可执行文件,非常适合移动)进行处理。
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)
目前最好的做法是使用SBT与Android插件;它会照顾一切为您: http://github.com/jberkel/android-plugin
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
如果您的必须的使用Eclipse和谷歌所提供的插件,那么你将有一个非标准的目录结构。我也写过关于如何处理这样的一个文章:http://www.assembla.com/wiki/show/scala-ide/Developing_for_Android
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!