4 ms·
Well done! On a related note - is using Scala also a viable option for android? Anybody tried?
by drorweiss 13y ago
Well done!
On a related note - is using Scala also a viable option for android? Anybody tried?
- koko775 13y agoSort of. It has issues with ProGuard, but the Scala standard library is a couple of megabytes, so you'll be adding some size to your application, or you'll have to very carefully test and configure. Additionally, Dalvik didn't have JIT until late in its maturity, so besides the normal slowdown from Java->Scala, expect it to slow down further by the less-efficient VM. It might be viable on newer devices, but it'll definitely have problems on older ones. Other than that, it does seem very feasible to write and deploy a Scala Android app.
- yareally 13y agoKotlin might have a better time on Android (though I too would prefer Scala), or at least better support. I haven't tried it yet on Android, but Jetbrains had a small tutorial for it on their blog[1]. I've just been putting it off since it was an immature language, but that may not be quite as true now. [1] http://blog.jetbrains.com/kotlin/running-hello-kotlin-on-android/ http://blog.jetbrains.com/kotlin/running-hello-kotlin-on-and...
- happy_dino 13y agoThere are pretty much no issues using Scala on Android. After running ProGuard, the Scala library takes up a few dozen kilobytes. Execution is as fast as Java. I remember running my Scala app on one of the first tablets (Android 2.x) without issues. The build system support is impressive and there is a whole community which focuses on Scala running on Android.
- yareally 13y agoHow difficult is it to tie in native libraries with Scala on Android?
- happy_dino 13y agoI think it is pretty similar to Java. Java has the native keyword, Scala has the @native annotation.
- koko775 13y agoAdmittedly, my experience on this was running it on now-ancient Android devices before Dalvik had JIT, and ProGuard at the time seemed to always render Scala apps un-runnable, for whatever reason. At least for me at the time, it was questionable. Nowadays, given the amount of work put into it, I'd put some trust in running it in production. But I'd still expect issues to come up now and then, as it's not a natively supported platform.
- mhaymo 13y agoHave you built a substantial application using Scala on Android? Bump uses Scala, and they had to do a lot of messing with build processes, and they ended up using Java for performance in places as well. I can't find the talk right now, but here's the slides: http://www.slideshare.net/michael.galpin/scala-on-android-experiences-at-bump-technologies http://www.slideshare.net/michael.galpin/scala-on-android-ex...
- happy_dino 13y agoFacebook didn't use Scala and they managed do hit a lot of same issues, too, like this one: http://code.google.com/p/android/issues/detail?id=22586 http://code.google.com/p/android/issues/detail?id=22586 Anyway, the presentation is almost two years old now.
- pjmlp 13y agoI think using Kotlin[1] or Xtend[2] might be a better option, because the projects explicitly support Android, while Scala and Clojure support are side projects by the community. [1] http://kotlin.jetbrains.org/ http://kotlin.jetbrains.org/ [2] http://www.eclipse.org/xtend/ http://www.eclipse.org/xtend/
- trailfox 13y agoKotlin looks pretty nice (even as a dumbed-down Scala), but it hasn't even hit beta yet. I have yet to meet anyone actually using xtend.
- pjmlp 13y agoTrue, but if you are using them for personal projects, it shouldn't matter. Now if it is for professional stuff, personally I would just use plain Java, as Scala and Clojure still seem to have issues.
- mhaymo 13y agoI tried and failed, although admittedly there were other factors at play. Bump tried and succeeded, but it took a lot of work: http://www.slideshare.net/michael.galpin/scala-on-android-experiences-at-bump-technologies http://www.slideshare.net/michael.galpin/scala-on-android-ex...