0
运行ProGuard后,我遇到了自定义注释问题。接口注释和ProGuard
下面是相关的代码:
注释
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface MyAnnotation {
}
类A延伸乙
...
@MyAnnotation
public interface CustomInterface {
}
...
抽象类乙
// mClass never found since MyAnnotation seems to be disappeared
// after obfuscation
for (Class<?> c : getClass().getClasses()) {
for (Annotation annotation : c.getAnnotations()) {
if (annotation instanceof MyAnnotation) {
mClass = c;
break;
}
}
}
我已经尝试了很多在相关文章中发现的保留语句,但没有一个适合这种情况。
没有ProGuard的运行代码正确地找到mClass成员的类。
的ProGuard配置有:
-keepattributes *Annotation*
感谢。
谢谢,但我已经有一个定义。 – Niko 2014-10-03 10:35:01