1

I am using Android Studio version v2.1.2 and Proguard doesn't work when I try to sign the release build, the build fails dramatically.

According to this link from developer docs Jack does obfuscation automatically.

Handles shrinking, obfuscation, repackaging and multidex Using a separate package such as ProGuard is no longer necessary.

I had to disable minifyEnabled flag and remove the line where we load proguard file; to get it working, after doing this; I inspected the apk file generated by doing the above and I cannot tell whether Jack really obfuscated and reduced redundant code as the release apk size is same as the debug apk size.

I need to understand how to make obfuscation work with the newer compiler as the documentation doesn't really help.

I am looking forward to understand the following questions.

Does Jack work without Proguard file?

Is there a way to specify Proguard file?

Arif Nadeem
  • 8,524
  • 7
  • 47
  • 78

1 Answers1

2

The Jack compiler has its own Shrinker and Obfuscator that re-uses existing Proguard rules (see supported directives).

The configuration should be the same as before, so you need to add the following to your buildType configuration:

minifyEnabled true
proguardFile getDefaultProguardFile('proguard-android.txt')
proguardFile 'your-proguard-file.txt'
T. Neidhart
  • 6,060
  • 2
  • 15
  • 38
  • Hi, thanks for the answer. I am still confused! Does Jack deobfuscate code on its own or does it need a Proguard file? If it accepts a proguardFile then what part of the obfuscation does it do on its own? – Arif Nadeem Jun 18 '16 at 20:17
  • 1
    If the Jack toolchain is enabled, ProGuard is not executed at all. The specified proguard rules are evaluated and applied by the toolchain itself. – T. Neidhart Jun 20 '16 at 07:10