

Is it possible/practical to program android in a language other than Java? - int_main_void

So the quick and dirty back story of this question is that when I originally read Google's response to the Java lawsuit by Oracle, Google made reference to the fact that android doesn't use the Java virtual machine (it uses some other VM, but the name escapes me at the moment) and went on to say essentially that Java isn't the only language that can be used with the OS.<p>So when I read that it really got me thinking about how great it would be if I could program android apps without using Java.  This is relevant to me because I know plenty of programming languages but I really haven't picked up Java or its predecessor C++ (technically I did make a basic android app essentially using what little I have learned of C).<p>Anyway its been a few months since I read that story and I have been digging around here and there (not too seriously) and have come across a few posts/blogs/ect affirming that it is possible and there is a tiny bit of documentation out there (for instance I found some python users out there using "Jythonroid")<p>Anyway the question is, is it really practical to program android in another language (yes I realize android utilizes XML in addition to Java) and if so which is the language(s) of choice?<p>Additionally, any bread crumbs that can be left leading to documentation would be very much appreciated.<p>Thank you.<p>Student<p>Daytona Beach, FL
======
dtwwtd
Depending on what you want to do there are some options.

The one that's been around longest but the most limited is the ASE (Android
Scripting Environment) [http://google-
opensource.blogspot.com/2009/06/introducing-an...](http://google-
opensource.blogspot.com/2009/06/introducing-android-scripting.html)

Using the ASE you can create some simple programs to do small tasks.

If you're looking to build a full app you're probably going to be looking at
either working through Java, or if you're on Gingerbread you can use C++.
Previous versions of Android allowed for C++ libraries being linked to your
apps but had no way to access the APIs for creating graphical interfaces.
That's now changed so I recommend you look into the SDK and NDK if you're
really serious about building on Android. <http://developer.android.com/sdk/>
<http://developer.android.com/sdk/ndk/>

The only other option that I know about is that the Mono framework is being
ported to android (.NET framework port). So if you know C# or any other .NET
language you may be able to start there, although I think it's currently in
closed beta. <http://monodroid.net/>

------
CyberFonic
Android uses the Dalvik virtual machine, which is a clean-room implementation
and different to JVM. Basically the .dex files are about 45% in size of
compressed JAR files. Dalvik has been optimised for small RAM & slow CPU
(compared to recent notebooks and desktops).

If you Google "Dalvik VM" you'll find lots of interesting information, too
many to list here. There's a Google presentation which is very good.

So the answer to your question, is that so far, AFAIK, there is no compiler
that directly generates Dalvik executables into .dex files. Currently, you
need a Java .class file or a .java file and get it translated into a .dex
file. But a retargetable compiler, like llc, could be customised to generate
.dex files directly. An interesting project.

------
NonEUCitizen
Yes, possible:

[http://android-
developers.blogspot.com/2011/01/gingerbread-n...](http://android-
developers.blogspot.com/2011/01/gingerbread-ndk-awesomeness.html)

------
ludicast
I hate Java, but am using it for Android to take full advantage of the
platform.

However, as an Actionscript guy I am curious about using AIR to write Android
apps. Specifically, if I did this, would I be able to offer upgrades to native
apps writen in Java down the road? Or would the Java versions have to be
installed as separate apps rather than upgrades?

------
arete
I wrote a couple of test android apps in scala and was very pleased with the
results. Scala is a huge improvement on java but gives you nearly the same
execution speed which is particularly important on devices with limited CPU
and RAM. There's a plugin for sbt (a scala build tool) that will assemble your
.apk and upload it to the emulator or a device.

~~~
T-R
I remember reading somewhere on Stack Overflow that Scala development on
Android was less than optimal. Do you know if the situation has changed at
all?

Edit: Here's where it was -

[http://stackoverflow.com/questions/476111/scala-
programming-...](http://stackoverflow.com/questions/476111/scala-programming-
for-android)

And some more information:

<http://riddell.us/ClojureAndAndroidWithEmacsOnUbuntu.html>

[http://stackoverflow.com/questions/3242034/android-
without-j...](http://stackoverflow.com/questions/3242034/android-without-java)

[http://stackoverflow.com/questions/2832773/alternatives-
to-j...](http://stackoverflow.com/questions/2832773/alternatives-to-java-on-
android)

[http://stackoverflow.com/questions/3002566/can-i-program-
for...](http://stackoverflow.com/questions/3002566/can-i-program-for-android-
using-any-jvm-language)

[http://stackoverflow.com/questions/1994380/substantial-
andro...](http://stackoverflow.com/questions/1994380/substantial-android-
development-in-scala)

~~~
int_main_void
Thanks for the links. It looks like scala is the most viable option currently,
but a few others exist as well. I will probably doodle in scala later this
week and see what I can make of it.

