Last week, Google announced the first version of a new experimental toolchain for Android. This new toolchain is designed to improve build times and simplify development by reducing dependencies on others tools.

This new toolchain is named Jack (Java Android Compiler Kit) and Jill (Jack Intermediate Library Linker). These two tools are at the core of the build process.


How does it work ?

When new tool chain is enabled, Jill will translate any libraries referenced to a new Jack library file (.jack). This prepares them to be quickly merged with other .jack files. All the process is managed by Android Gradle Plugin that must collect any .jack library files, along with your source code, and compiles them into a set of dex files. During the process, Jack also handles any requested code minification. Output is assembled into APK file as usual. Support for multiple dex files is also offered.

jack_jill_compiler

How to use Jack and Jill ?

Like said previously, Jack and Jill is managed by Android Gradle Plugin and are available in the Android 1.0.0+ Gradle plugin. They are also already available in the 21.1.1+ Build Tools for Android Studio.

To start, you need to be sure to use these versions of Build Tools when you build your application. Then, you must simply add a single line in your build.gradle file and perform a new build to get APK built thanks to Jack and Jill :


android {
 ...
 buildToolsRevision '21.1.1'
 defaultConfig {
 // Enable the experimental Jack build tools.
 useJack = true
 }
 ...
}

 

You could also use Jack and Jill in your build.gradle thanks to Product Flavors.

Jack and Jill new toolchain is still experimental but be sure it will become the new way to build APK files in the future. So, use the first version to try and don’t hesitate to report eventual issues to Google Android Team to improve Jack and Jill.