Java – How to exclude a class from being reserved by proguard

How to exclude a class from being reserved by proguard… here is a solution to the problem.

How to exclude a class from being reserved by proguard

I added the following line in the obfuscator config:

 -keep class com.mypackage.** {*; }

But now proguard doesn’t remove my class com.mypackage.BuildConfig .class from the results. I would like to remove it.

How do I exclude reservations for a given class?

Thanks

Solution

You can use the following rules:

-keep class !com.mypackage.BuildConfig, com.mypackage.** { *; }

Related Problems and Solutions