Google has released a test version of their new JACK compiler for Android developers with Android Studio 2.1.
My question is, how do we enable obfuscation for the AP
J.A.C.K. obfuscation does not appear to be supported in the latest released Gradle Plugin (v2.1.0).
If you enable JACK when using the latest v2.1.0 plugin, it will tell you Jack requires Build Tools 24.0.0 or later requiring you to use the preview tools.
Using android gradle v2.2.0-alpha1, Build Tools-v24rc4, Platform Tools-v24rc3, and Sdk Tools-v25.1.7rc1 I was able to get obfuscation to be performed by JACK.
When enabled inside defaultConfig it complained Minifying the variant used for tests is not supported when using Jack., because minifyEnabled true was configured in the debug build.
So, I created a custom build type and enabled it there:
buildTypes {
...
custom {
minifyEnabled true
proguardFiles 'proguard-android-JACK.txt-2.2.0-alpha1'
jackOptions {
enabled true
}
}
There was a problem when using proguardFiles getDefaultProguardFile('proguard-android.txt'). It errorred with: com.android.jack.api.v01.ConfigurationException: Error while parsing ..., . So, I just removed the lines it complained about and then just manually specified my modified configuration file.