【问题标题】:Proguard processing interface will delete the interface method throwsProguard 处理接口会删除接口方法 throws
【发布时间】:2017-06-05 09:44:48
【问题描述】:

我在Android上使用proguard的时候,发现proguard在处理interface之后,throws的interface方法被删除了。

之前:

public interface Factory {

Card create(Profile profile) throws CardException;

}

proguard-rules.pro:

-keep interface Factory { *; }

之后:

public interface Factory {
Card create(Profile var1);
}

可以看到方法的 throws 被移除了。

我不知道优化、混淆或缩小的原因。

【问题讨论】:

  • 如果 CardException 是您的自定义类,因此您还必须在 proguard 中声明它。
  • 是的,我做到了。 -keep public class * 扩展 java.lang.Exception
  • stackoverflow.com/questions/1115515/… -keepattributes 例外

标签: java android proguard android-proguard


【解决方案1】:

CardException类的基本包替换com.example和 将此行放入 proguard 文件中

-keep class com.example.** { *; }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多