Num*_*our 7 java android annotations proguard
我正在使用自己的注释:
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface Loggable { }
Run Code Online (Sandbox Code Playgroud)
并使用Proguard进行混淆.我使用-keepattributes *Annotation*
Proguard配置来保留注释.
在运行时,当我使用一切工作从带注释的类中检索注释时someClass.getAnnotation(Loggable.class)- 我检索我的注释的非null实例.
但是,当我想将它应用于某个类的带注释的方法时,我从中检索null someMethod.getAnnotation(Loggable.class).
Proguard是否从方法中删除了注释?我怎么告诉它不要这样做?
我正在使用Proguard 4.7.
ele*_*ven 11
你需要使用keepclassmembers参数:
-keepclassmembers class ** {
@com.yourpackage.Loggable public *;
}
Run Code Online (Sandbox Code Playgroud)