Monday, March 21, 2016

Biting Pain of Jack and Jill Tool Chain

This is a note of warning concerning the Android Jack and Jill Tool Chain. We have a very popular use case of having to target Android 4.x devices while at the same time targeting Android 7.0 devices.

Jack and Jill Tool Chain does not use proguard in the android gradle plugin implementation as of early 2016. As of early 2016 annotation processing such as Dagger and Butterknife still not working. And of course any 3rd party libs you use has not switched to the Jack and Jill Tool Chain just yet.

You might think well I will just set source and target compatibility to Java 8 and proceed like you have always done using the 3rd party retrolambda backporting libs. Not so as with preview N the android gradle plugin stuff changed in that the usejack in defaultConfig setting is depreciated and setting source and target compatibility to Java 8 automatically sets the android gradle plugin to use the Jack and Jill Tool chain.

Here are your options:

1. If testing any preview N features is not a priority than use the
   AndroidStudio 2.0 as it has the non-N Preview Android Gradle Plugin which I presume still has the useJack setting in the defaultConfig block still working. You will still be able to use retrolambda backports, dagger, butterknife, proguard rule files, etc.

That still means you have some things to track down and fix manually, such as the mistake of using file uri schemes.

If you have used retrolambda back ports than that is the only option you have, at this early 2016 moment.

Why not Another option? Remember, a certain OEM goofed up on the Android 4.x series and decided to include a support library that could not be updated, cough Samsung you MFer, so we use proguard repackaging rules to fix that mistake and thus if targeting android 4.x devices you cannot switch to the Jack and Jill Tool chain just yet due to that mistake.