mikebai.com

  • Home
  • dev
  • DotNET
  • M365
  • 搞笑
  • 杂七杂八
  • FocusDict
個人BLOG
it developer
  1. Main page
  2. dev
  3. Main content

Android Studio利用Gradle删除没有使用到的资源和代码文件

2017-01-21 130hotness 0likes 0comments

一、打包时忽略无用资源

  我们在打包的时候默认会把没有用到的资源(比如图片)也打包成app,徒增了应用的大小。现在我们可以利用Gradle来优雅的去除没有用到的资源文件了!

就是在gradle中配置shrinkResources true。这个东西依赖于minifyEnabled,所以minifyEnabled也要为true才行。

 

官方推荐在正式版中这么写:

复制代码
android {
buildTypes {
release {
minifyEnabled
Tag: Nothing
Last updated:2017-01-21

mikebai

This person is a lazy dog and has left nothing

Like
< Last article
Next article >

COPYRIGHT © 2025 mikebai.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang