The fewer options -keep you can use, the better your results will be in terms of optimization and obfuscation. If you donโt have time to find the best configuration, you can use a more conservative approach. The most conservative solution is to save all classes, fields and methods in the library, so any internal reflection will continue to work:
-keep class 3rd_party_lib_name.** {*;}
Slightly less conservative, but usually enough: save all public APIs:
-keep public class 3rd_party_lib_name.** { public *; }
Even less conservative: keep only public classes, but not necessarily their fields or methods:
-keep public class 3rd_party_lib_name.**
Some experiments may go the way.
As ben75 mentions, this does not take into account third-party libraries that reflect your own code.
source share