15

When I use minifyEnabled true shrinkResources true gradle task failed with an exception `Execution failed for task ':xxxx:packageRelease'.

Unable to compute hash of D:\asspace\xxxx\xxxx\build\intermediates\classes-proguard\release\classes.jar `

Lemon
  • 487
  • 4
  • 12
  • 2
    Could you run with --info option to get more log output ? – msdx Sep 08 '15 at 02:37
  • It would be helpful if you could show full console logs – SILINIK Oct 02 '15 at 19:33
  • Possible duplicate of [Error:Execution failed for task ':app:packageRelease'. > Unable to compute hash of /../AndroidStudioProjects/../classes.jar](http://stackoverflow.com/questions/31643339/errorexecution-failed-for-task-apppackagerelease-unable-to-compute-hash) – blahdiblah Nov 03 '16 at 01:29

3 Answers3

9

Please, read warnings in console carefully. I`ve also faced with similar issue and in my case there were warnings about processing one of third party libraries. After applying corresponding changes related with the library to proguard file, all started to work correctly

SILINIK
  • 988
  • 7
  • 16
6

This fixed the problem for me: add those to the Proguard:

-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.
Georgi Koemdzhiev
  • 11,421
  • 18
  • 62
  • 126
  • 1
    Almost the same,some classes can not be proguarded.I have checked my libs and added rules in my proguard file. – Lemon Oct 12 '15 at 03:21
4

I had this same issue. For me, my project's proguard file, namely, proguard-rules.pro, was somehow renamed to proguard-android.txt.

The proguard-android.txt is reserved for Android's default proguard rules, so essentially, I was overriding Android's proguard file, which was causing havoc, and I would get the Unable to compute hash message.

Once I changed the filename in my project from proguard-android.txt to proguard-rules.pro I was able to get things working.

WindsurferOak
  • 4,861
  • 1
  • 31
  • 36