如何使用Java注释来指导Android的Proguard的?注释、如何使用、Proguard、Java

由网友(偷鱼罐头的猫)分享简介:在使用Proguard的采用Android,这是通过反射仅调用的方法(例如,在XML的onClick定义回调属性)被错误地剥离出来。When using Proguard with Android, methods that are only invoked via reflection (e.g., callbac...

在使用Proguard的采用Android,这是通过反射仅调用的方法(例如,在XML的onClick定义回调属性)被错误地剥离出来。

When using Proguard with Android, methods that are only invoked via reflection (e.g., callbacks defined in onClick XML attributes) are erroneously stripped out.

一个解决方案此问题是添加每个受影响的类和方法您proguard.cfg。

One solution for this issue is to add each affected class and method to your proguard.cfg.

如何使用Java注释来达到同样的效果?

How can I use Java annotations to achieve the same effect?

我觉得这将使code自文档,这将避免code和proguard.cfg漂流不同步。然而,Android的Proguard的似乎并不附带的文件中所提及的annotations.jar。

I feel that would make the code self-documenting and it would avoid code and proguard.cfg drifting out of sync. However, Android's Proguard doesn't seem to ship with the annotations.jar mentioned in its documentation.

推荐答案

您可以从官方ProGuard的发布检索annotations.jar和annotations.pro。然后,您应该能够使用注释作为讨论

You can retrieve annotations.jar and annotations.pro from an official ProGuard release. You should then be able to use annotations as discussed in

http://proguard.sourceforge.net/manual/examples.html#annotated

所有必要的选项可以进去proguard.cfg。

All the necessary options can go in proguard.cfg.

阅读全文

相关推荐

最新文章