Meet Jack and Jill: Google’s new Android compilers

Android diverging further from official Java? Don't go breaking your crown

20 Reg comments Got Tips?

Google has come up with new Android compilers, spotted in the latest preview SDK by Eric Lafortune at Saikoa.

The compilers are in the Android SDK 21.1 and are currently called jack.jar and jill.jar. They are not enabled by default, but require the directive “useJack true” in the configuration file for the gradle build tool.

The useJack directive invokes the new compilers

The useJack directive invokes the new compilers

Presuming an Android application is written in Java, the normal build process is compilation into Java bytecode (.class files) using the Oracle javac compiler, and then compilation of the bytecode into a .dex (Dalvik Executable) using dx.jar, part of the Android SDK.

Although Android applications are usually written in Java, they are not executed by a JVM (Java Virtual Machine), but by Google’s Dalvik VM, or in more recent versions, a runtime called ART (Android Runtime).

If useJack is enabled, jack.jar compiles Java code to .dex format, bypassing Oracle’s compiler. It uses an intermediate bytecode format called .jayce, according to Larfortune. What about compatibility with binary library code in .class files? This is where jill.jar comes in, compiling .class files into another .jayce so that Jack can compile them into the .dex output.

What is the purpose of the new compilers? Google has said nothing so this is open to speculation; and since this is preview material, they could be dropped entirely. Presumably Google sees advantage in optimising the compiling chain for Android by using its own compiler. “The Jack and Jill compilers will streamline the Android build process and improve build performance,” says Lafortune.

What about future compatibility with Oracle Java? Lafortune notes that Jack and Jill are not compatible with Java 8, released in March this year. If they become the official Android compilers, it could signify increased divergence between Oracle Java and Android Java.®

Bootnote

"Jack and Jill" seems an odd choice for compiler names since in the nursery rhyme (the meaning of which is obscure) both characters fall over; then again, crashes are common in software development.

SUBSCRIBE TO OUR WEEKLY TECH NEWSLETTER


Biting the hand that feeds IT © 1998–2020