Which programming languages can I use on Android Dalvik?

JavaPythonAndroidScalaDalvik

Java Problem Overview


In theory, Dalvik executes any virtual machine byte code, created for example with the compilers of

  • AspectJ
  • ColdFusion
  • Clojure
  • Groovy
  • JavaFX Script
  • JRuby
  • Jython
  • Rhino
  • Scala

Are there already working versions of bytecode compilers for Dalvik available for other languages than Java?

Java Solutions


Solution 1 - Java

Solution 2 - Java

Scala works very well.

I'm programming my Android application projects in Scala (Website written in Chinese with some screenshot, source code @ GitHub), and it is pretty easy to setup the evnviroment (without IDE, using SBT as build tool).

It could access every API in Android SDK, so anything you could do in Java, you could do it in Scala too.

You may check this blog entry to see how to build Android application with Scala and SBT.

Solution 3 - Java

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, its output includes no extra VM and only includes explicitly imported libraries. To the end-programmer, this means Kawa's performance and executable size are nearly identical to standard Java (ProGuard not required).

Kawa also includes lots of 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.

Solution 4 - Java

I haven't played with it but I know that Scala works.

http://www.scala-lang.org/node/160

Solution 5 - Java

Another JVM language that works on Android is Kotlin with Anko, both from Jetbrains.

Solution 6 - Java

Mercury also works on Android, using its Java backend. I've written a simple app that should help someone get started (there are still few other examples), and mercury-android-helper also for this purpose (although at this exact moment, it's short a few commits. And neither are using ProGuard yet, so the .apk size is shocking.)

Although the other posts here are cheerful about Scala-on-Android, posters in Scala forums are more concerned by Scala's ability to blow through some of Dalvik's limitations, and people who do use it say they reserve it for non-production code. (Some discussion about Scala's problems here.)

I can't say yet if Mercury has its own problems with Dalvik, but I've switched to it from Scala for the time being.

Solution 7 - Java

The dynamically typed languages wont be possible until Dalvik supports JIT (Just In Time) compiling. I believe there is JIT support in one of the experimental Eclair branches, but it is not yet officially available/supported in Android.

Solution 8 - Java

  1. Angular + nativeScript

  2. Reactnative

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmjnView Question on Stackoverflow
Solution 1 - JavaParesh MayaniView Answer on Stackoverflow
Solution 2 - JavaBrian HsuView Answer on Stackoverflow
Solution 3 - JavabugView Answer on Stackoverflow
Solution 4 - JavamhmhmhmhView Answer on Stackoverflow
Solution 5 - JavaThomasView Answer on Stackoverflow
Solution 6 - JavaJulian FondrenView Answer on Stackoverflow
Solution 7 - JavaJeff GilfeltView Answer on Stackoverflow
Solution 8 - JavaIon VladescuView Answer on Stackoverflow