Hacker News new | ask | show | jobs
by heavyset_go 968 days ago
Android doesn't use the JVM.
2 comments

It actually does, the devices might run ART, however the whole developer toolchain depends heavily on the JVM, Gradle, Android Studio/InteliJ, the pleothoara of little CLI tools to transform those .class files into .dex, desugar modern JVM bytecodes into JVM bytecodes that can actually be mapped into existing .dex ones (for pre-Android 12 devices), library calls that need to be polyfilled into something else,....
Stupid question: why does android use ART (and Dalvik before that)? I guess it's more performant for mobile phones, but then, is there a reason why other java apps don't use it outside of android? Has anyone tried using ART/Dalvik outside of the android ecosystem?
Easy, Google screwing up Sun licensing for embedded devices and creating their own Java based ecosystem from scratch.

Note that ART as it is now is the third implementation, first it was Dalvik, then ART pure AOT, and now ART interpreter/JIT/AOT.

Nokia and Sony-Ericsson already had relatively good J2ME implementations for Symbian, and Blackberry OS was powered by Java, when Android came out.

Unfortunately it didn't went for Google the same way, as it did for Microsoft.

Gosling interview on the matter,

https://www.youtube.com/watch?v=ZYw3X4RZv6Y&feature=youtu.be...

Definitely agree about the toolchain, I was referring more to code execution on the OS itself.
Thanks, didn't know.
It's a bit of a question about what you define the term "JVM" as. For many people it just means the thing which runs bytecode java was compiled to, in which case the Android runtime (ART) is a JVM (it has AOT, JIT and can run bytecode prodced from Java if done so in the right way).

But a more nit-picky/correct definition would expect the JVM to follow various specs (e.g. expect the bytecode the have exact the same format, features etc. as the one you find in a classical java application) and have various features which do not apply to the ART at all.

Or in other words, people which have nothing to do with java might call the ART a JVM in a generic way but people which do might be for good reason very insistent that this isn't the case. (Also Google lawyer will be VERY insistent it's no a JVM.)

Which is a kind of nit picking for Google laywers, as the approach taken by Dalvik/ART has been quite common in the embeded space, see PTC, Aicas, Aonix, microEJ, Websphere Real Time,...

Not all of them are available, however all of them do support AOT compilation, and their own bytecode format more optmized for their use cases than regular .class files.

The big difference between them and Google, is that they always played by the Sun/Oracle rules regarding Java licensing.