Jack, Jill & Java 8
Submitted by Chaitanya Nettem (@chaitanyanettem) on Monday, 19 September 2016
This talk will go over the new Jack and Jill toolchain & the new Java 8 features that they bring to Android land. You will learn about -
- The existing Android toolchain of javac, dx, jarjar etc.
- How Jack and Jill replace the existing toolchain
- New Java 8 features that Jack brings
- Drawbacks to Jack you should consider before upgrading
What are Jack and Jill (aka why should you care about this?)
Jack is Google’s new compiler/toolchain for Android. It compiles Java source into Android dex bytecode. It will replace the current javac, ProGuard, jarjar, and dx toolchain.
The talk will cover
- How both toolchains work
- What Jack & Jill do differently
- Why you should upgrade to Jack
- What some of Jack’s cons are
Jack vs javac+dx
- Legacy javac toolchain: javac (.java → .class) → dx (.class → .dex)
- New Jack toolchain: Jack (.java → .dex)
- We’ll cover details about how both work
How to enable Jack?
- Go over changes required in build.gradle if you wish to try out Jack
- Cover some gradle options that Jack provides
Reason why you want to upgrade - Java 8 features
Features compatible back to Gingerbread
(these use anonymous classes and hence are compatible back to Gingerbread)
- Method References
- Type annotations
Features supported in Nougat and beyond
- Stream APIs
- Interfaces - default method implementations & static methods
- Repeatable annotations
Reasons why you might not want to upgrade
- Transform API is not yet supported. This means that some libraries do not yet work with Jack. The most prominent example being RealmDB. Bugs filed here and here
- Lint detectors which operate on a Java bytecode level will not work since there is no intermediate bytecode when you use Jack.
- Jack is currently slower than javac + dx
I have been working on Android apps for the past 2 years. I am currently a freelance developer who works with Android and Python. You might know me from other events like PyCon 2014 where I presented a poster on Creating a Fall Detector using Raspberry Pi and Python or from my Android apps like, Search for Reddit.