Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Android Proguard (kotlin, retrofit, okhttp, gson)
# Kotlin
# COMMON KOTLIN
-dontnote kotlin.**
-dontwarn kotlin.**
-keepclassmembernames class kotlinx.** {
volatile <fields>;
}
-dontnote kotlinx.**
-keep class kotlinx.coroutines.**
# retrofit
-keepattributes Signature
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Exceptions
-keepclasseswithmembers class * {
@retrofit2.http.* <methods>;
}
-dontnote retrofit2.Platform
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
-dontwarn retrofit2.Platform$Java8
-dontwarn retrofit.RxSupport*
-dontwarn retrofit.appengine.UrlFetchClient
-dontnote retrofit.http.RestMethod
-keepclasseswithmembers class * {
@retrofit2.* <methods>;
}
-keepclasseswithmembers interface * {
@retrofit2.* <methods>;
}
# okhttp
-dontwarn okio.**
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault
-dontwarn javax.annotation.**
#gson
-keep class com.google.gson.stream.** { *; }
-keep class com.google.gson.* { *; }
-keep public class com.google.gson.** {
public private protected *;
}
-keep class com.google.appengine.** { *; }
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
-keep class com.google.gson.* { *; }
-keep class com.google.inject.* { *; }
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
-keepclassmembers enum * { *; }
-keep,allowobfuscation @interface com.google.gson.annotations.*
-dontnote com.google.gson.annotations.Expose
-keepclassmembers class * {
@com.google.gson.annotations.Expose <fields>;
}
-keepclasseswithmembers,allowobfuscation,includedescriptorclasses class * {
@com.google.gson.annotations.Expose <fields>;
}
-dontnote com.google.gson.annotations.SerializedName
-keepclasseswithmembers,allowobfuscation,includedescriptorclasses class * {
@com.google.gson.annotations.SerializedName <fields>;
}
-keepclassmembers enum * {
@com.google.gson.annotations.SerializedName <fields>;
}
#OKHTTP3
-dontwarn okhttp3.**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment