2016-11-21 142 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]