Mark Buikema
Mark Buikema

Reputation: 2540

Proguard: Keep all classes that have annotation

I want to keep the class name and class fields names of all classes that have my custom Annotation:

@Retention(CLASS)
@Target(ElementType.TYPE)
public @interface DoNotObfuscate {
}

I tried this:

-keep @com.mypackage.DoNotObfuscate public class *

but that did not work.

Upvotes: 4

Views: 1688

Answers (1)

Nikolay Podbutsky
Nikolay Podbutsky

Reputation: 13

In order to keep class fields you should add "{*;}" at the end:

-keep @com.mypackage.DoNotObfuscate public class * {*;}

Upvotes: 1

Related Questions