androidandroid-studioproguarddexguard

How to prevent Dexguard from obfuscating the resources folder in anroid studio?


I want to keep the \res folder so dexguard dont obfuscated this \res directory.Because dexguard is renaming all the file and some of the files have space at the end which is creating huge problem for me so I am trying to keep the res/ folder as unobfuscated.

I have tried all this one by one to check if it works but i am failed to keep the whole res/ folder from obfuscation

-keep class *.R$
-keepnames class com.safarifone.waafi.R$raw { *; }

-keep class **.R$* {
    <fields>;
}

-keeppackagenames com.safarifone.waafi.R$

-keepresources res/**

-keepdirectories MyAccountApp/src/main/res/*


-keepattributes InnerClasses
 -keep class **.R
 -keep class **.R$* {
    <fields>;
}

-keepclassmembers class **.R$* {
     public static <fields>;
}
-keep class **.R$*

-keepnames class com.safarifone.waafi.R$layout { *; }
-keep public class com.safarifone.waafi.R$layout { *; }

Solution

  • In order to keep all resources files unobfuscated by DexGuard use a rule like

    -keepresourcefiles res/**