Ravindra babu
Ravindra babu

Reputation: 38940

Prevent a directory from proguard obfuscation

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?

Upvotes: 4

Views: 3943

Answers (2)

Ashwin
Ashwin

Reputation: 7667

Add the following line at the top of your proguard-rules.pro file:

-keeppackagenames your.complete.packagename

Upvotes: 2

Khalid Taha
Khalid Taha

Reputation: 3313

If you mean directory is the package, then in proguard-rules.pro add the following line:

-keep class com.example.something.packageName.** { *; }

Upvotes: 1

Related Questions