Ore*_*hak 5 java android annotations proguard
我的项目中有两种类型的注释:Annotation1和Annotation2。两者都是运行时注释。所以,我的问题是如何保留Annotation1和剥离Annotation2?
例子:
class Test {
@Annotation1
@Annotation2
String name;
}
Run Code Online (Sandbox Code Playgroud)
我想Annotation2从所有领域中消失并被Annotation1保留在任何地方。
我找不到这是否可能。我只知道如何使用以下方法保留所有注释:
-keepattributes *Annotation*
Run Code Online (Sandbox Code Playgroud)
这可能吗?如果没有,为什么?
如果其他地方未使用(检索、转换、调用等)相应的注释类,ProGuard 会自动从类/字段/方法中删除注释。您不能强制 ProGuard 删除注释,但您可以告诉它保留看似未使用的注释:
-keep @interface com.example.MyAnnotation
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5491 次 |
| 最近记录: |