4 ms·
Develop for Android with Scala
- gecko 17y agoI really love my Droid, and generally find Android to be a fairly well-designed SDK, but I also find working in Java really annoying. One of my good friends took the time to make it really easy to develop for Android using Scala instead. Since I know that we have a lot of Android users in these forums who are working on various apps, I thought that this might make the whole experience more pleasant.
- davidw 17y agoCool! Do you know if this ads much/anything to the apk runtime size? The documentation seems a little bit scarce at the moment. I need to get around to doing up Hecl for Android 'nicely'.
- andrew1 17y agoIT includes a proguard.jar file which I assume is used to remove unnecessary classes from your final application. I managed to get Scala working with Android a while ago by following online guides (a lot more hassle than this looks to be!) and I used proguard for this purpose.
- stefanrusek 17y agoIt took me forever to get it working for another app, and after I got it working, I decided to start this project, which makes things a lot easier since it just works.
- biafra 17y agoI did a hello-world in Scala for Android (without this toolkit) shrinking it with proguard and the apk increased by 800kbyte. Installing on a real device or the emulator is noticeable slower.
- andrew1 17y agoYou should be able to get the final size to less than 100kb, I can't remember exactly what I ended up with using Proguard but I think it was 30-40kb. It should manage to remove virtually all the Scala library code as hardly any of it would be used.
- stefanrusek 17y agoI used it to create a hello world app that clocks in at 18K.
- stefanrusek 17y agoI added a little more info to the AFS home page.
- wheaties 17y agoThis goes up here and now I'm so annoyed at myself for not getting better directions to the Friendly Toast for the Scala talk on Android SDK.
- vladev 17y agoWow. First place for Scala. The world is becoming a better place!
- basil 17y agoHow is the performance compared to straight Java? I know the Clojure on Android project is at the moment, slower due to the functional nature of the language. Apparently the Dalvik garbage collector has to work overtime cleaning up because of the emphasis on creating new objects rather than mutating existing ones.
- stefanrusek 17y agoI have one app in the market that uses it and it runs great.
- mark_h 17y agoCool! Which one, out of curiosity?
- briancooley 17y agoThis one, maybe? http://cn.androlib.com/android.developer.stefan-rusek-qpAq.aspx http://cn.androlib.com/android.developer.stefan-rusek-qpAq.a...
- bad_user 17y ago> I know the Clojure on Android project is at the moment, slower due to the functional nature of the language. There are two things that can hurt performance for functional languages on top of the Java VMs ... the lack of TCO and the mapping of a type-system that's too different to be mapped efficiently. In Clojure though what hurts is its dynamic nature, but you can go a long way by using type-annotations when you discover clear bottlenecks.
- plinkplonk 17y agoIs there any reason that the Dalvik VM shouldn't get TCO even if the JVM doesn't? I read somewhere that implementing TCO would necessitate a change in the bytcode and the jvm guys didnt ant to do this to break backward compatibility. N.B: I haven't investigated the Dalvik VM and/or the Android ecosystem in any great detail, so this might be afoolish question,but any answers appreciated.
- jrockway 17y agoNice. I looked into using Scala for an Android app a few months ago, and the number of moving parts involved to get "Hello World" working scared me off. Automating that makes it less scary, so I am glad to see this. I wish I could write my Android apps in Haskell instead, though. Scala just isn't quite as nice.
- pufuwozu 17y agoLast year I submitted a patch to Dalvik which adds support for JNI in Scala. So Scala calling C (via the Android NDK) should now work in all recent versions of Android!
- SingAlong 17y agoAny Android OpenGL bindings for Scala? I would like to try some 3D stuff with it. The first time I tried 3D stuff on Android, I didn't like the fact that I had to write ~70 lines of Java code just to get a blank black screen