I have a software problem that fits the functional approach to programming, but the target market will be on the Android OS. I ask because there are functional languages that compile to Java's VM, but Dalvik bytecode != Java bytecode.

Alternatively, do you know if the dx utility can intelligently convert the .class files generated from functional languages like Scala?

Edit: In order to add a bit more helpfulness to the community, and also to help me choose better, can I refine the question a bit?

  • Have you used any alternate languages with Dalvik? Which ones?
  • What are some "gotchas" (problems) that I might run into?
  • Is performance acceptable? By that, I mean the application still feels responsive to the user.

I've never done mobile phone development, but I grew up on constrained devices and I'm under no illusion that there is a cost to using non-standard languages with the platform. I just need to know if the cost is such that I should shoe-horn my approach into default language (i.e. apply functional principles in the OOP language).

  • I've updated the question. Thank you @geekosaur for your initial answer. That was starting information that I was looking for. Mar 30, 2011 at 12:12
  • I've heard whispers on Haskell cafe of people doing this with FFI + Haskell + Courage. I believe there is a library on github/hackage for it Jun 20, 2013 at 16:25

5 Answers 5


There's a blog post by Christian Neukirchen called Programming for Android with Scala that shows how to build Scala programs for Android. It looks like dex can handle Scala, but you need to use a tool like ProGuard to cut the Scala class library down to size because dex will otherwise import the entire Scala runtime.

There's also some ongoing work on Android programming with Erjang and Clojure.

  • 1
    It appears that just about all the options you gave have serious performance penalties. That tells me that the options aren't really mature enough for prime time just yet. Maybe in another year? Mar 30, 2011 at 12:13
  • As long as you don't use large parts of scala's class library, there should not be any significant performance penalty. Also, you can automate the whole process with maven.
    – Kim
    Mar 30, 2011 at 13:15
  • @Berin: I think the future is not using JVM-targeting languages — dex is after all optimized to deal with not just Java bytecode but also Java's bytecode conventions (you'll see some discussion of this in the links I provided earlier) — but targeting the Dalvik VM directly. Conceivably that could end up being faster than the Java-dex route.
    – geekosaur
    Mar 30, 2011 at 17:33
  • 1
    And for those wondering: the Dalvik VM bytecode is documented: opcodes, instruction formats. I see some possibilities for peephole optimizations not possible by targeting the JVM right away, let alone smarter optimizations using the Dalvik architecture directly.
    – geekosaur
    Mar 30, 2011 at 17:37
  • @Kim, the article I found said the performance problem was in the differences between the class loading algorithms for Java and Dalvik. If I stay away from the dynamic language features of Scala, I should be able to avoid the class loading issues. That same issue plagued the other options. It's still all rather new right now. I still may end up trying it out on this project--it's a proof of concept any way. Mar 30, 2011 at 17:59

Kawa is a lovely but little known variant of Scheme that has existed quietly for many years and runs on both the JVM and Dalvik, natively. Therefore, similar to Mirah, its output includes no extra VM and only includes explicitly imported libraries. Kawa has lots of standard macros (including some specific to Android APIs) that make for a nice clean syntax (assuming one is not averse to parentheses), and adds some tasty goodies on top of Scheme, like "promises" (lazy eval and futures in one). The language is quite robust and well-documented, and has been actively maintained and evolving since the early days of Java.

The Java Advent Calendar summarizes Kawa's merits with some informative examples and links.

  • Wow, thanks for pointing me towards Kawa! I've been itching to do some non-Java Android development and this looks really promising.
    – Evicatos
    Jun 20, 2013 at 17:14

Beside scala I may suggest you to have a look on mirah on android, here are some details: http://threebrothers.org/brendan/blog/strange-loop-2011-mirah-for-android-development/

So what makes this approach 'better' than the other languages? Mirah is a static typed language with resemblance to ruby. Which allows for some functional style arguably better than java.Usually 'porting' a language to android is problematic because you need to port the standard library too. Mirah avoids this by avoiding to have a standard lib. In the referenced material there is a nice overview from REAL WORLD experience running mirah on android and how it turned out. (try 2)

  • 1
    Please don't repost the same answer, all you had to do to ask for your answer to be undeleted after you edited it was to flag it for moderation attention.
    – yannis
    Sep 13, 2012 at 8:14

There has been a lot of movement on Clojure on Android (https://github.com/clojure-android/neko)Neko.
There are performance issues related to the Dalvik VM and the Clojure Compiler; these issues are slowly being resolved.

A presentation about the current (July 2015) status: https://www.youtube.com/watch?v=mVXTcAEKgF8&index=9&list=PLZdCLR02grLoBx0Y5ZrpdmLxc160PIwzQ


It's not quite there yet but Miguel de Icaza, a guy who knows a thing or two about the Davlik VM says "F# for droid is on their list of things to do." So I'd say an officialish package is coming.

Not the answer you're looking for? Browse other questions tagged or ask your own question.