Prevent a directory from proguard obfuscation

本秂侑毒 提交于 2020-06-27 11:34:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!