问题
I have gone through several stackoverflow posts regarding proguard obfuscation
How to keep/exclude a particular package path when using proguard?
How to make Proguard ignore external libraries?
How to exclude specific jars from injars during obfuscation using proguard?
But I did not find answer to exclude a particular directory to prevented from obfuscation.
Directory structure:
libs
=> lib1
=> a.b.c.package
A.java
B.java
=> lib2
=> d.e.f.package
C.java
D.java
=> lib3
=> g.h.i.package
E.java
F.java
Instead of adding multiple lines in -keep
option with each package name, I would like to exclude entire libs package from obfuscation.
Is there any way to stop obfuscation of a particular directory libs as shown below?
And is there a way to exclude java run time classes from obfuscation?
回答1:
If you mean directory is the package, then in proguard-rules.pro add the following line:
-keep class com.example.something.packageName.** { *; }
回答2:
Add the following line at the top of your proguard-rules.pro file:
-keeppackagenames your.complete.packagename
来源:https://stackoverflow.com/questions/47506682/prevent-a-directory-from-proguard-obfuscation