我有与实现另一个这样的类的内部接口的类:

public class DownloadService extends Service implements Downloader.Callback {
    ....
    // override interface methods and other stuff
    ....
}

public class Downloader {
    private Callback callback;

    public Downloader(Callback callback) {
        this.callback = callback;
    }

    ....
    ....

    public interface Callback {
        // interface methods
    }
}


现在,当我在此代码上使用proguard时,会收到如下警告:

com.example.DownloadService$Downloader: can't find referenced method 'java.util.List access$000(com.example.DownloadService)' in program class com.example.DownloadService
com.example.DownloadService$Downloader: can't find referenced method 'void access$100(com.example.DownloadService)' in program class com.example.DownloadService
com.example.DownloadService$Downloader: can't find referenced method 'android.app.NotificationManager access$200(com.example.DownloadService)' in program class com.example.DownloadService


我该如何解决?我尝试将以下内容添加到我的proguard.cfg中:

-keepclasseswithmembers class com.example.DownloadService { *; }
-keep public interface com.example.tasks.Downloader$Callback { *; }

最佳答案

我想到了。 com.example.DownloadService$Downloader是我最近删除的内部类。 Build> Clean Project修复了它。

我一生的4个小时-没了。

关于java - 内部接口(interface)的Proguard配置,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50629499/

10-11 05:01
查看更多