Android without Java

Java is the language of choice when it comes to develop android apps. Will it last forever? Apple pushes Swift, a replacement for Objective-C, will Google follow the same path?

Dalvik

In 2007, Google chose Java as the primary language for developing apps on the Android platform. Some said that it was an heresy to use such a beast for a mobile platform. Some saw a great pragamatic decision: many developers know Java; Leveraging their knowledge for a brand new platform should make the transition easier than learning a complete new language.

Both are right, the Dalvik, the Java VM of Android, is not the fastest way to execute code but it does the job quite well (especially after the introduction of a JIT in Android 2.2).

A lot of programming languages targets the JVM. It’s a stable and fast platform. By targeting the JVM, developers can reuse a whole bunch of engineering effort put by years of production. The problem is that Dalvik does not use the same bytecode as the regular JVM. Which means that, despite being based on Java, Android is an island on its own. Android programmers can not use anything else than the vanilla Java.

NDK

Actually this is false, developers can use the NDK to use C or C++. You still need Java to call the C code via JNI so this is not the prettiest way but it works. Many games of the Play Store are developed in C/C++ with multi-platforms frameworks. It works as long as you don’t need a native look & feel.

Some companies (e.g., Dropbox) started to embrace the NDK to develop cross-platform applications. Most of the business logic is developed in C/C++ and reused across Android and iOS. The UI is still written in Java or Objective-C but at least there’s code reuse.

Kotlin, Ruby & Groovy

As Apple announced Swift at WWDC this year, Android developer are wondering if Google will do the same for Android. Swift removes a lot of boilerplate from Objective-C and follows the functional trends. Hell even Java 8 is a bit more fluent than before.

Other languages targeting the Dalvik VM already exists. Kotlin by Jetbrains is probably the most common. It looks great and seems to behave quite well.

In the last few months, RubyMotion announced that it will support Android this summer.

The Groovy team merged the branch with Android support. And they released a native app coded in Groovy.

A Go developer wants to port it to Android as well. Actually, this one only targets the NDK. The goal is to code games in Go, not real native apps.

Some people see Dart as a great new language for Android. Dart popularity is probably not booming at the moment but that might change if Dart can run natively on Android.

Google is currently working on ART, a new faster runtime for Dalvik. I doubt they will offcially support another language while this runtime is not mature and ready for production. Or should we see in the ART runtime a nest for a new language?

In any case, the future looks bright for Android development. We have some toy projects that would be ideal candidates for Kotlin and Groovy. We’ll let you know if these two languages are great fit for the platform. Stay tuned.


Francois Stephany's headshot
Francois Stephany

Francois is the founder of Ta Mère SCRL. He likes to tinker with code, apps and juggling sticks. In his spare time, you'll find him running mid-distance races or driving his good old Dax in the countryside.
Francois blogs at tulipemoutarde.be