AndResGuard Android资源混淆工具 项目简介
AndResGuard 是一款 Android资源混淆工具,资源混淆组件不涉及编译过程,只需输入一个apk(无论签名与否,debug版,release版均可,在处理过程中会直接将原签名删除),可得到一个实现资源混淆后的apk(若在配置文件中输入签名信息,可自动重签名并对齐,得到可直接发布的apk)以及对应资源ID的mapping文件。同时可在配置文件中指定白名单,压缩文件(支持*,?通配符),支持自动签名,保持旧mapping,7z重打包,对齐等功能。 本工具支持 Linux、Window 跨平台使用,但测试表示若使用7z压缩,Linux 下的压缩率更高。示例代码:apply plugin: 'AndResGuard'
buildscript {
dependencies {
classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.1.9'
}
}
andResGuard {
mappingFile = null
use7zip = true
useSign = true
keepRoot = false
whiteList = [
//for your icon
"R.drawable.icon",
//for fabric
"R.string.com.crashlytics.*",
//for umeng update
"R.string.umeng*",
"R.string.UM*",
"R.string.tb_*",
"R.layout.umeng*",
"R.layout.tb_*",
"R.drawable.umeng*",
"R.drawable.tb_*",
"R.anim.umeng*",
"R.color.umeng*",
"R.color.tb_*",
"R.style.*UM*",
"R.style.umeng*",
"R.id.umeng*"
//umeng share for sina
"R.drawable.sina*"
]
compressFilePattern = [
"*.png",
"*.jpg",
"*.jpeg",
"*.gif",
"resources.arsc"
]
sevenzip {
artifact = 'com.tencent.mm:SevenZip:1.1.9'
//path = "/usr/local/bin/7za"
}
}简单用法:java -jar andresguard.jar input.apk若想指定配置文件或输出目录:java -jar andresguard.jar input.apk -config yourconfig.xml -out output_directory若想指定签名信息或mapping信息:java -jar andresguard.jar input.apk -config yourconfig.xml
-out output_directory -signature signature_file_path storepass_value
keypass_value storealias_value -mapping mapping_file_path若想指定7zip或zipalign的路径(若已设置环境变量,这两项不需要单独设置):java -jar andresguard.jar input.apk
-7zip /shwenzhang/tool/7za -zipalign /shwenzhang/sdk/tools/zipalign若想用7zip重打包安装包,同时也可指定output路径,指定7zip或zipalign的路径(此模式其他参数都不支持):java -jar andresguard.jar -repackage input.apk -out output_directory
-7zip /shwenzhang/tool/7za -zipalign /shwenzhang/sdk/tools/zipalign
buildscript {
dependencies {
classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.1.9'
}
}
andResGuard {
mappingFile = null
use7zip = true
useSign = true
keepRoot = false
whiteList = [
//for your icon
"R.drawable.icon",
//for fabric
"R.string.com.crashlytics.*",
//for umeng update
"R.string.umeng*",
"R.string.UM*",
"R.string.tb_*",
"R.layout.umeng*",
"R.layout.tb_*",
"R.drawable.umeng*",
"R.drawable.tb_*",
"R.anim.umeng*",
"R.color.umeng*",
"R.color.tb_*",
"R.style.*UM*",
"R.style.umeng*",
"R.id.umeng*"
//umeng share for sina
"R.drawable.sina*"
]
compressFilePattern = [
"*.png",
"*.jpg",
"*.jpeg",
"*.gif",
"resources.arsc"
]
sevenzip {
artifact = 'com.tencent.mm:SevenZip:1.1.9'
//path = "/usr/local/bin/7za"
}
}简单用法:java -jar andresguard.jar input.apk若想指定配置文件或输出目录:java -jar andresguard.jar input.apk -config yourconfig.xml -out output_directory若想指定签名信息或mapping信息:java -jar andresguard.jar input.apk -config yourconfig.xml
-out output_directory -signature signature_file_path storepass_value
keypass_value storealias_value -mapping mapping_file_path若想指定7zip或zipalign的路径(若已设置环境变量,这两项不需要单独设置):java -jar andresguard.jar input.apk
-7zip /shwenzhang/tool/7za -zipalign /shwenzhang/sdk/tools/zipalign若想用7zip重打包安装包,同时也可指定output路径,指定7zip或zipalign的路径(此模式其他参数都不支持):java -jar andresguard.jar -repackage input.apk -out output_directory
-7zip /shwenzhang/tool/7za -zipalign /shwenzhang/sdk/tools/zipalign