News for hackers. Stuff that matters.
Re:Show HN: Java 7 Features Backported to Android by drorweiss on Monday May 06, 2013 @01:34AM (#5661025)
Well done!

On a related note - is using Scala also a viable option for android? Anybody tried?

Re:Show HN: Java 7 Features Backported to Android by koko775 on Monday May 06, 2013 @01:50AM (#5661070)
Sort 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.

Re:Show HN: Java 7 Features Backported to Android by yareally on Monday May 06, 2013 @01:59AM (#5661095)
Kotlin 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-and...

Re:Show HN: Java 7 Features Backported to Android by happy_dino on Monday May 06, 2013 @02:30AM (#5661154)
There 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.

Re:Show HN: Java 7 Features Backported to Android by mhaymo on Monday May 06, 2013 @07:18AM (#5661787)
Have 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-ex...
Re:Show HN: Java 7 Features Backported to Android by happy_dino on Monday May 06, 2013 @12:36PM (#5663217)
Facebook 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

Anyway, the presentation is almost two years old now.

Re:Show HN: Java 7 Features Backported to Android by koko775 on Monday May 06, 2013 @02:47AM (#5661188)
Admittedly, 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.
Re:Show HN: Java 7 Features Backported to Android by yareally on Monday May 06, 2013 @02:40AM (#5661173)
How difficult is it to tie in native libraries with Scala on Android?
Re:Show HN: Java 7 Features Backported to Android by happy_dino on Monday May 06, 2013 @04:56AM (#5661453)
I think it is pretty similar to Java. Java has the native keyword, Scala has the @native annotation.
Re:Show HN: Java 7 Features Backported to Android by pjmlp on Monday May 06, 2013 @02:19AM (#5661135)
I 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/

[2] http://www.eclipse.org/xtend/

Re:Show HN: Java 7 Features Backported to Android by trailfox on Monday May 06, 2013 @03:48AM (#5661310)
Kotlin 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.
Re:Show HN: Java 7 Features Backported to Android by pjmlp on Monday May 06, 2013 @05:07AM (#5661473)
True, 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.

Re:Show HN: Java 7 Features Backported to Android by mhaymo on Monday May 06, 2013 @07:20AM (#5661792)
I 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-ex...