Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Tuesday, April 17, 2012
Is using scala on android worth it? Is there a lot of overhead? Problems?
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?
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.
Hi I have a tutorial here(http://saadstechblog.blogspot.com/2011/09/scandroid-scala-android-tutorial.html) that shows how to run scala on android and sticks close to the android way of doing things. The only issue is that every time you have to shrink the files to be able to deploy them, because of that the build cycle is a tad longer. btw the tutorial has a github project with all the configuration needed.
Working with Scala should be mostly painless, as the dex compiler just works with bytecode - which is exactly what Scala produces.
ReplyDeleteYour 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.
ReplyDeleteI 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.
ReplyDeleteHi I have a tutorial here(http://saadstechblog.blogspot.com/2011/09/scandroid-scala-android-tutorial.html) that shows how to run scala on android and sticks close to the android way of doing things. The only issue is that every time you have to shrink the files to be able to deploy them, because of that the build cycle is a tad longer. btw the tutorial has a github project with all the configuration needed.
ReplyDelete