在 build.gradle 中配置
android {
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),'some-other-rules.txt'
//proguardFile 'some-other-rules.txt' 配置单个文件这样
}
}
}
android的sdk中已经为我们提供了两个默认的配置文件,我们可以拿过来进行使用,proguard-android.txt和proguard-android-optimize.txt
配置选项
- minifyEnabled // 是否开启混淆
- shrinkResources // 去除无用的resource文件
- proguardFiles getDefaultProguardFile // 加载混淆配置文件
map文件输出
mapping目录在 \app\build\outputs\mapping\release
参考
http://www.07net01.com/2015/07/873121.html
http://bbs.csdn.net/topics/391072001
http://blog.csdn.net/hyr83960944/article/details/41644195
http://my.oschina.net/sammy1990/blog/271306
http://www.softwareace.cn/?p=1151