相关疑难解决方法(0)

使用 proguard 保留特定的注释

我的项目中有两种类型的注释:Annotation1Annotation2。两者都是运行时注释。所以,我的问题是如何保留Annotation1和剥离Annotation2

例子:

class Test {
    @Annotation1
    @Annotation2
    String name;
}
Run Code Online (Sandbox Code Playgroud)

我想Annotation2从所有领域中消失并被Annotation1保留在任何地方。

我找不到这是否可能。我只知道如何使用以下方法保留所有注释:

-keepattributes *Annotation*
Run Code Online (Sandbox Code Playgroud)

这可能吗?如果没有,为什么?

java android annotations proguard

5
推荐指数
1
解决办法
5491
查看次数

标签 统计

android ×1

annotations ×1

java ×1

proguard ×1