5

I am trying to use the new Shrinker for debug builds (at 3:14)

https://youtu.be/xxx3Fn7EowU?t=3m14s

Also I want to enable shrinking unused resources after that.

My config is

        debug {
        minifyEnabled true
        useProguard false
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }

But Gradle sync fails with an error message:

Error:Build-in class shrinker and resource shrinking are not supported yet.

Is this possible or I need to enable full proguard to use resource shrinking?

android_dev
  • 3,886
  • 1
  • 33
  • 52

2 Answers2

1

Ryan R is completely right. Just small addition. You could either completely remove useProguard false string from your buildTypeclosure, or set it to useProguard true if you are in release build type.

Alex_297
  • 249
  • 1
  • 8
  • I have tried again. Now I get this error: Minifying the variant used for tests is not supported when using Jack. – android_dev Feb 02 '17 at 11:54
  • 1
    Accordint to [this answer](http://stackoverflow.com/questions/37314760/android-how-to-perform-obfuscation-with-the-jack-compiler/37326896#37326896) minifying is not supported in debug buldType. Try yo use it in release mode. Also everything will work fine if you disable Jack compiler, even in debug mode. I still haven't migrated to Jack because its using leads to a lot of troubles now. – Alex_297 Feb 02 '17 at 13:34
  • Will give it a try. Yeah, but in order to use the new Java 8 language features like Lambda and Method references, you need to use the Jack toolchain. – android_dev Feb 02 '17 at 19:58
  • I have tried again..It works only if you also enable code shrinking. – android_dev Mar 25 '19 at 15:38
0

For me, I had to disable useProguard false and it was able to build.

Ryan R
  • 8,342
  • 15
  • 84
  • 111