2016-11-21 55 views
0

我們使用dexguard,也有在dexguard-project.txt以下設置Dexguard:避免串混淆

-keepresourcefiles res/** 
-keepresourcexmlattributenames res/** 
-keepresources res/** 

我也試圖提供 資源的變化/價值/ strings.xml中,如:

-keepresourcefiles res/*/strings.xml 
-keepresourcexmlattributenames res/*/strings.xml 
-keepresources res/*/strings.xml 

-keepresourcefiles res/values/* 
-keepresourcexmlattributenames res/values/* 
-keepresources res/values/* 

in path。 但字符串的鍵值越來越模糊。

context.getResources().getIdentifier(key, STRING_FOLDER,context.getPackageName()); 

返回0.(其中key是一個字符串值)。

我也曾嘗試

-dontshrink 

什麼是避免串obfsucation的正確方法?

回答

2

爲了保持字符串資源被混淆/內聯/由DexGuard縮水,你將需要添加以下規則:

-keepresources string/** 

-keepresources指令的格式如下:

-keepresources [resourceType]/[resourceKey]