2

Proguard optimisation passes 5 was working correctly and build did the passes at all five levels (refer below log), however suddenly Gradle skips (without any warning) the ProGuard optimization passes (log shown below)

Environment consists of Android Studio 3.4.1, Gradle plug in 3.4.1 and ProGuard 6.0.3. R8 is disabled in gradle.properties and useProguard is enabled in app module build.gradle. App is on Java platform.

Tried below options suggested in other SO posts (not related to ProGuard optimisation), but there is no success.
remove .gradle folder.
invalidated cache in Android studio
tried changing Gradle plugin to 3.3.1

Working Proguard Optimization Gradle log

Shrinking... 
Printing usage to ... 
Removing unused program classes and class elements...
  Original number of program classes: 7098
  Final number of program classes:    5859
Optimizing (pass 1/5)...
Optimizing (pass 2/5)...
Optimizing (pass 3/5)...
Optimizing (pass 4/5)...
Optimizing (pass 5/5)...
Shrinking...
Removing unused program classes and class elements...
  Original number of program classes: 5815
  Final number of program classes:    5815
Obfuscating...

Skipped optimisation Gradle log

Shrinking...
Printing usage to ...
Removing unused program classes and class elements...
  Original number of program classes: 7415
  Final number of program classes:    6151
Obfuscating...

Tried upgrading Android Studio to 3.5 version by disabling R8, but same issue persists. Even tried the same on multiple machines.

There is no SO post for this type of issue. Please assist.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

0

Found the solution for me -

in build.gradle I changed this line:

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

to this:

proguardFiles 'proguard-rules.pro'

i.e. take out the proguard-android.txt portion out. This was based on this answer which stated that

If you don't want to optimize, use the proguard-android.txt configuration file instead of this one, which turns off the optimization flags

Not sure it's what you had, but worth a shot. Also, I'd make sure you understand whether you're on R8 (the new minifier) or actually Proguard, which is rapidly transitioning out

Cheers!

Oded Ben Dov
  • 9,936
  • 6
  • 38
  • 53