Skip to content

Proguard

Jacksgong edited this page Apr 12, 2019 · 7 revisions

1. If you only use com.liulishuo.okdownload:okdownload

There aren't any proguard rules required.

2. If you are using com.liulishuo.okdownload:okhttp and okhttp3

First of all, please don't forget to add okhttp proguard rules first, and then add following proguard rules:

-keepnames class com.liulishuo.okdownload.core.connection.DownloadOkHttp3Connection

3. If you are using com.liulishuo.okdownload:sqlite

Please add following proguard rules:

-keep class com.liulishuo.okdownload.core.breakpoint.BreakpointStoreOnSQLite {
        public com.liulishuo.okdownload.core.breakpoint.DownloadStore createRemitSelf();
        public com.liulishuo.okdownload.core.breakpoint.BreakpointStoreOnSQLite(android.content.Context);
}

So if you are using all okdownload provided components and okhttp3 on your project like sample project, just added following rules:

# okhttp https://github.com/square/okhttp/#proguard
-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn javax.annotation.**
-dontwarn org.conscrypt.**
# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

# okdownload:okhttp
-keepnames class com.liulishuo.okdownload.core.connection.DownloadOkHttp3Connection

# okdownload:sqlite
-keep class com.liulishuo.okdownload.core.breakpoint.BreakpointStoreOnSQLite {
        public com.liulishuo.okdownload.core.breakpoint.DownloadStore createRemitSelf();
        public com.liulishuo.okdownload.core.breakpoint.BreakpointStoreOnSQLite(android.content.Context);
}

# Findbugs
-dontwarn edu.umd.cs.findbugs.annotations.SuppressFBWarnings`