0

I'm trying to use the shrinkResources feature.

I'm using JackCompiler and JAVA_1_8, and compiling the release version of the flavor named "prod". This flavor is only used to take advantage of the better compile time when using the "dev" flavor with minSdk 21. There are no "flavor-specific" resources. They are all in the only common res folder.

When running the compilation I get the following error.

:app:packageProdRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong: A problem was found with the configuration of task ':app:packageProdRelease'.
File '/app/build/intermediates/res/resources-prod-release-stripped.ap_' specified for property 'resourceFile' does not exist.
Gabriel Morin
  • 2,100
  • 1
  • 14
  • 26

3 Answers3

9

In order for shrinkResources to work, you must also set

minifyEnabled true

Resource shrinking requires the unused code removal step, otherwise you get the error.

It's stated in the documentation here: https://developer.android.com/studio/build/shrink-code.html#shrink-resources

wojtek.kalicinski
  • 1,090
  • 7
  • 13
0

In your gradle file set 'shrinkResources false'

  • It worked... though what to do in case we also want to set shrinkresources to true.. This issue is coming up only after upgrading Android Studio 2.2 – Rushikesh Korgaonkar Sep 21 '16 at 17:53
  • Hello Manuel, thank you for your answer, though the point of my question is how can I make "shrinkResources true" work on my configuration. – Gabriel Morin Sep 22 '16 at 12:25
-1

are u update your android studio to 2.2?if that degrade classpath 'com.android.tools.build:gradle:2.2.0' to classpath 'com.android.tools.build:gradle:2.1.3' but give up instant run

lyao
  • 1