I want to be able to write apps for my phone in in something other than the Java language; for example Ruby or Python. This isn’t one of the things my group at Google has asked me to look at, but I think it’s worth doing and worth some of my time. I’m writing this today because I’m amused by the contrast with the current hubbub over Apple having tightened the developer thumbscrews.

Why? · I like the libraries, but I have to confess that these days, I’ve slipped into the camp of those who find the Java language verbose and rigid and overly ceremonious. It bothers me less on Android than on general-purpose computers, because Android apps tend to have a pretty thin layer of application code between calls out to the network and GPS and accelerometer and so on.

But having said that, I’m pretty sure that in, for example, Ruby, I could write less than half the number of lines of code to get any particular job done. Also, I entirely loathe Java generics.

What Google Thinks · As usual, I’m not speaking officially for Google here, but my impression is that if there were an official reaction, it’d be along the lines of “Uh, whatever, we’re focused on shipping this next release.” Which is likely appropriate; The Androiders are so zoned-in on building a great SDK and runtime and Market that my wild-eyed screw-the-semicolon ideas are not exactly likely to become front-of-mind. Well, unless I can show that they work.

It may come as a surprise to regular readers here, but there are vast expanses of our profession, including some of the best and brightest, who haven’t got the dynlang bug yet.

And the Official Policy? · That’s a non-issue. An Android app has to be an APK file, and if you generate/sign one of those and are in the developer program, and it’s not illegal or porn or something, you can drop it into the Android Market. (If falls afoul of Market rules, you can post it on your own website or some other market, and people can still install it, no jailbreaking required.) How you build the APK is up to you.

In practical terms, if you want it to look-and-feel like an Android app, you have to use the Android SDK; but what language you generate those bytecodes and method calls with, and how you compile it, well, why should anyone care? I’m using Eclipse, and while it Just Works with the library and emulators and other tools, it’s failed to win my heart. I’m seriously thinking of going to Emacs and seeing if I could replace Ant with Rake. And, of course, every piece of the toolchain is open-source and thus in principle can be forked and improved and replaced.

If what you produce sucks, the word will get around quick; having used the official Android toolchain won’t save you. And if it doesn’t suck, not having used it won’t get in the way.

I’m actually a little puzzled by the Apple policy; the technical side I mean, not the business issues, which Gruber explains with ruthless clarity. I can see Apple wanting to enforce the use of their APIs, but the compulsory linkage to the Objective C programming language makes me feel like I’m missing something; where is it carved in stone that it provides the optimal, impossible-to-improve, way to use the iPhone APIs? And if nobody’s allowed to try anything else, how will we find out?

Anyhow, the market will decide; the big small-m market, not the iPhone nor Android Markets. But in the meantime, I’d say we’ve got more scope for fun over here on the Android side.

Candidates · Right at the moment the Rubyists seem to be in the lead in this race, what with Ruboto and Duby. I can’t think of any architectural reasons why Jython shouldn’t be a candidate, except for Sun let Frank Wierzbicki go and I’m not sure anyone’s working on it much, these days.

Also, in theory you ought to be able to use the Android NDK to get the native C versions of Ruby and/or Python going. It’d be a slog, but the idea doesn’t seem insane.

There are lots of other languages, and maybe one of them is a better bet; My focus on Python and Ruby reflects my own prejudices, but my mind is open. And of course JavaScript is already a first-class citizen pretty well everywhere.

In Conclusion · Got any good ideas for how to let me write serious, shippable Android code without ever having to do this again?

HashMap<String, List<Person>> buf = new HashMap<String, List<Person>>();

If you do, get in touch. I might be able to help you help me.