android - proguard 配置与 groundy Tasks

标签 android annotations proguard groundy

我正在使用包含 GroundTask 类的 android“Groundy”库,它使用了注释。此外,我创建了一个类

public class DownloadTask extends GroundyTask

和一个回调对象:

  private final Object mCallback = new Object() {
    @OnProgress(DownloadTask.class)
    public void onNiceProgress(@Param(Groundy.PROGRESS) int progress) {
        mProgressDialog.setProgress(progress);
    }
....

但是在使用 proguard 进行混淆之后,用“OnProgress”注释的方法永远不会被调用(但没有发生错误)

在我添加的proguard文件中

-keep class com.telly.groundy.*** {
public protected private *;
}
-keepattributes *Annotation*, EnclosingMethod
-keepattributes *OnSuccess*
-keepattributes *OnProgress*
-keepattributes *OnCancel*
-keepattributes *OnCallback*
-keepattributes *OnFailure*
-keepattributes *OnStart*
-keepattributes *Param*
-keepattributes *Traverse*

-keep class com.my.namespace.DownloadTask {
 public protected private *;
}

知道这里可能缺少什么“保留”配置吗?

最佳答案

我刚刚在自述文件中添加了一个基本的混淆器配置。它看起来像这样:

-keepattributes *Annotation*

-keepclassmembers,allowobfuscation class * {
    @com.telly.groundy.annotations.* *;
    <init>();
}

-keepnames class com.telly.groundy.generated.*
-keep class com.telly.groundy.generated.*
-keep class com.telly.groundy.ResultProxy
-keepnames class * extends com.telly.groundy.ResultProxy
-keep class * extends com.telly.groundy.GroundyTask

关于android - proguard 配置与 groundy Tasks,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20824693/

相关文章:

android - 如何使用不同风格或不同构建类型的不同混淆器文件?

android - Android 服务如何与 Activity 交互

Android Webview 隐私浏览

android - Gradle:排除依赖包

android - 改造空闲 java.lang.IllegalStateException : Method path does not contain {}

android - 将 @SuppressLint ("RestrictedApi") 与 AndroidX 库一起使用是否安全?

java - Hibernate Configuration 有必要使用 AnnotationConfiguration 吗?

android - proguard.cfg 文件丢失

android - 如何将ProGuard添加到具有依赖项的项目中?

java - 查找运动事件结束的 View (按钮)