What is the difference between these two proguard options?
-keep class com.myclass.**
-keep class com.myclass.** { *; }
What is the difference between these two proguard options?
-keep class com.myclass.**
-keep class com.myclass.** { *; }
The first rule will only keep the classes themselves (and the default constructors).
The second rule will also keep all methods and fields in the classes.
Preserve all classes in the
com.myclass
package and any sub-packages. Even if shrinking and optimization steps should alter the structure of or remove these classes, do not do so.Preserve all classes in the
com.myclass
package as defined above as well as all fields and methods in those classes.An example of the difference: With the first command, my entry point methods (such as
main
) can still be shrunk, optimized, and obfuscated. In order to keep the signatures of those methods intact, I can specify the methods or fields I need to keep (or just the wildcard*
as you did, though I would think that's too broad). This is essential for reflection and other situations where signatures and names must be kept intact.Note that
-keepnames
and similar commands also keep the signatures, but only if they weren't already removed during shrinking.