“minifyEnabled” vs “shrinkResources” - what's the difference? and how to get the saved space?

后端 未结 3 424
悲&欢浪女
悲&欢浪女 2020-12-12 20:04

Background

According to the \"Resource Shrinking\" webpage of Andriod documentations (here), you can minimize the app\'s size via the build.gradle file, by using t

3条回答
  •  隐瞒了意图╮
    2020-12-12 20:46

    The answers to the questions 2 and 4 can be found in this video from Android Dev Summit 2015 along with some other useful information on this topic.

    An overview of the points discussed were:

    • shrinkResources is taken into account only if minifyEnabled is true

    • minifyEnabled shrinks code, while shrinkResources shrinks resources that are not referenced from the code

    • By default shrinkResources runs in safe mode. If you switch it to strict you can provide tools:keep and tools:discard flags manually to influence the resource shrinking.

提交回复
热议问题