views:

561

answers:

3

After doing the whole "enterprise" programming for a while, I'm seriously disillusioned by the language itself and always feel quite hampered if I have to go back to it. The project size of your average Android app isn't too intimidating and the libraries are actually quite nice regarding their coding style, but if I could avoid Java, I'd certainly do.

So that's the question: Can I avoid it? While there are lots of JVM language that would be an option on desktops and servers, the Dalvik VM and the devices themselves pose some limits. This seems to be a bit better in 2.2 with the JIT, but limiting myself to the cutting edge would be a rather harsh decision.

The only alternative I know that's used somewhat seems to be Scala. Is there some possibility I'm missing? Clojure seems to run in exactly the problems I've illustrated above with Dalvik, but as the AppInventor is built on Kawa there might be hope for a Lisp on the mobile platform?

What other languages are already usable or make strides towards that?

+1  A: 

This link has some details on how to get scala apps working on android. I'm sure you can do something similar for clojure or other jvm languages.

Ruboto is aiming to bring JRuby in.

Elfred
+4  A: 

Is there some possibility I'm missing?

Tons of 'em!

Clojure seems to run in exactly the problems I've illustrated above with Dalvik

I'm not aware of this. Any JVM language that is an ahead-of-time compiler (i.e., generates Java bytecode on the developer PC) should work with Dalvik.

but as the AppInventor is built on Kawa there might be hope for a Lisp on the mobile platform

AFAIK, App Inventor is only using Kawa for code generation.

What other languages are already usable or make strides towards that?

Well, there's HTML5 (Javascript), which works OK in offline mode.

Or, there's PhoneGap (HTML+CSS+Javascript).

Or, there's Rhodes (Rails-esque apps in Ruby on the device).

Or, there's Titanium Appcelerator Mobile (HTML+Javascript, but with Javascript hooks to render native UI widgets).

Or, there's Flash, at least for Android 2.2+.

Or, there's AIR...well, OK, that's still in pre-release.

As Elfred noted while I was writing this, there is JRuby with Ruboto.

There are Bedrock, Corona, DroidScript, Flixel, MobiForms, MonoDroid, MoSync, Squeak, and SuperWaba.

There's C/C++ through the NDK, though that's mostly for adding extension libraries to a Java app more so than writing full-on native-code apps.

There's SL4A (formerly the Android Scripting Environment, or ASE), which is your gateway to Python, Perl, Lua, and other scripting languages. As of this moment, you cannot package these scripts up as APKs, but they're working on that.

Now, none of these are going to give you precisely the look of a "regular" Android app. For those, you need a JVM language with ahead-of-time compilation. And there is no question that bog-standard Java Android apps are far and away the most numerous. But unlike some fruit-flavored operating systems that block this sort of thing, you have lots of places to experiment with alternatives to traditional Java coding with Android.

Some balding guy is writing a book that is going to review all of these options, but that's only partially ready right now.

CommonsWare
Right now I'm mostly looking at "native" applications. And my info about Clojure might be a bit old, but I remember something on the mailing list a couple of months ago where the startup times were quite prohibitive. Just getting something to run on Dalvik/Android isn't hard, but it's hard to sell something that dramatically underperforms.
mhd
+10  A: 

Personally, I'd say Scala is your best bet right now. It works really well, with the one drawback being that you are required to include Scala as a dependency (which will increase the size of your application).

dbyrne
The size of the application can be kept under control using ProGuard.
missingfaktor