Android使用AndResGuard進行資源混淆,壓縮。
源碼地址:GitHub - shwenzhang/AndResGuard: proguard resource for Android by wechat team
集成完成后編譯過程中出現如下錯誤:
14:57:05 copy res file not in resources.arsc file:IUk.xml 14:57:05 copy res file not in resources.arsc file:kLL.png 14:57:05 copy res file not in resources.arsc file:nVK.xml 14:57:05 copy res file not in resources.arsc file:Ph3.png 14:57:05 copy res file not in resources.arsc file:EsW.xml
...省略N行
14:57:12 do not have the compress data path =r/MfA.xml in resource.asrc 14:57:12 do not have the compress data path =r/ThH.xml in resource.asrc 14:57:12 do not have the compress data path =r/VqH.xml in resource.asrc 14:57:12 do not have the compress data path =r/37u.xml in resource.asrc
...省略N行
此時請檢查你的 com.android.tools.build:gradle:4.2.2
如果版本號是4.2.2或以上版本,那出現該問題就是由于和gradle的資源混淆沖突了,二者選其一即可,那么如何關閉gradle的資源混淆呢?
在gradle.properties中添加如下代碼即可
#禁止自帶的資源混淆 android.enableResourceOptimizations=false