Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Using Scala on Android with Intellij IDEA (github.com/yareally)
3 points by yareally on May 21, 2013 | hide | past | favorite | 1 comment


I don't consider my submittal to be any sort of complex project (really more of a guide to doing something far easier than normal), but there's probably a fair amount of us that would love to have a working, stable Android Java alternative that's also free to use and integrates well. I thought I would share this for anyone that felt the same way as I do about having to always use Java. I searched Google extensively for someone getting Scala to work without some sort of external SBT (Scala Build Tool) plugin that requires you to type out commands and renders some of the features of Intellij (like debugging) unusable.

I couldn't find any such solution, so I just tried building it without any sort of external workarounds. Did not work of course, since Scala is too large for the Dalvik Compiler. However, ProGuard reduces the size to something manageable and is built into Intellij, so enabling that + telling it not to obfuscate the sources, allows you to build in the same manner you would with Java in Intellij and lets you focus on what matters--the code :)

I'm not a Scala expert by any means yet--I've only really delve into it the last week or two after previously seeing fellow developers mention on HN that it was a viable alternative to Java on Android. They were right and I'm glad I tried it. I've had prior experience with functional languages (F# and some Haskell) and the similarities of Scala to languages such as Python and C# make it pretty easy to dive into if one is familiar with any of those. Having prior functional experience helps with the learning curve of some of the powerful features, but not necessary. Since Scala is a imperative/functional hybrid, you can work with either paradigm (or both).

So far, I haven't had any issues using Scala on Android. Works for me as if I were using Java, which is awesome. Plus, Intellij lets you use both in a project without issues and will automatically convert from one language to the other (but generally takes some rewriting to get it more optimized for Scala since it has many additional features).

Feel free to ask any questions though or I'm sure there's some with more Scala experience than me that can answer some language specific things much better than I can.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: