AndResGuard
Introduction: proguard resource for Android by wechat team
Tags:
A fork of https://github.com/shwenzhang/AndResGuard, only bug fixs,no new features.
Changes
1.2.23
兼容 AGP 7.4.x
1.2.22.6
- only support gradle 7.0+
- sevenzip support osx aarch
1.2.23-SNAPSHOT (from 1.2.22.6 )
- update sevenzip version to 21.07 (except windows)
- add new arch linux-arm_32/ linux-aarch_64
How to Use(refer origin repo,and modify as belows)
change group id:
com.tencent.mm --> io.github.leon406
change version:
stable(mavenCentral): 1.2.21 --> 1.2.23
snapshot: 1.2.21 --> 1.2.22.6-SNAPSHOT
add snapshots repo to your build.gradle
maven {
url "https://s01.oss.sonatype.org/content/repositories/snapshots/"
}
问题及临时解决方案
无法进行混淆
AGP 4.2.+ 引入资源压缩, 但效果不如 AndResGuard,两个同时启用无法正常使用,需要在 gradle.properties 禁用
android.enableResourceOptimizations=false测试 AGP 4.2.2 AGP 7.0.4 可以正常使用
7zip 无法运行
配置本地7zip文件路径
sevenzip { path = "xxxx/SevenZip-windows-x86_64.exe" }避免字体资源混淆 (API 级别 26 引入字体资源)
andResGuard { whiteList = [ "R.font.* ] }ConstraintLayout 布局约束失效
constraint_referenced_ids 不能混淆,请用通配符加入白名单,如 constraint_xxx
andResGuard { whiteList = [ "R.id.constraint* ] }已测试 AGP 版本
- 7.0.4
- 7.1.1 有兼容问题
- 7.3.1
- 7.4.1 (1.2.23+ 支持)
- 8.x 不支持 (jdk 版本升级 17,功能无法正常使用, 建议使用低版本 jdk +命令行进行混淆), 可以使用(lalakii 的 AGP 8.x 版本)
