shrinkResources true引发的问题及解决

背景

今天偶然发现release版本的包上出现图片无法显示的问题,之前在debug版一直没有出现,因为用的SDK需要把图片资源放到drawable下,分析了下apk包,发现相应的图片资源没有被打包进来,起初认为是混淆的原因,但是混淆只是针对代码,后发现了这个配置shrinkResources true

介绍

“resource shrinking”: the automatic removal of resources that are unused, at build time, in the packaged app. In addition to removing resources in your project that are not actually needed at runtime, this also removes resources from libraries you are depending on if they are not actually needed by your application.

以上是官方说明,大概意思是在应用构建打包的过程中自动删除没有引用的资源,对依赖的库同样有效

使用

Note that resource shrinking only works in conjunction with code shrinking (such as ProGuard).That’s how it can remove unused resources from libraries; normally, all resources in a library are used, and it is only when we remove unused code that it be

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值