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?
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).
ReplyDeleteScala Programming for Android
Can I program for Android using any JVM language?
Getting Started Programming in Dynamic Languages in Android
Have you look at Mirah? It gives you a ruby like syntax and compiles to Java. It's been labeled the CoffeeScript of Java.
ReplyDeleteIs there some possibility I'm missing?
ReplyDeleteTons 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.
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.
ReplyDeleteRuboto is aiming to bring JRuby in.
MoSync use c/c++ or Javascript or a combination of both. Create Hybrid or Native apps. Henrik
ReplyDelete