Created
September 12, 2019 13:12
-
-
Save margin555/d8e8714b633d014b1f7c5b43ff288ffe to your computer and use it in GitHub Desktop.
Proguard rules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add project specific ProGuard rules here. | |
# You can control the set of applied configuration files using the | |
# proguardFiles setting in build.gradle. | |
# | |
# For more details, see | |
# http://developer.android.com/guide/developing/tools/proguard.html | |
# If your project uses WebView with JS, uncomment the following | |
# and specify the fully qualified class name to the JavaScript interface | |
# class: | |
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | |
# public *; | |
#} | |
# Uncomment this to preserve the line number information for | |
# debugging stack traces. | |
#-keepattributes SourceFile,LineNumberTable | |
# If you keep the line number information, uncomment this to | |
# hide the original source file name. | |
#-renamesourcefileattribute SourceFile | |
-dontwarn android.databinding.** | |
-keep class android.databinding.** { *; } | |
-dontwarn okio.** | |
-dontwarn retrofit2.Platform$Java8 | |
-keepclasseswithmembers class * { | |
@retrofit2.http.* <methods>; | |
} | |
# Proguard configuration for Jackson 2.x (fasterxml package instead of codehaus package) | |
-keep class com.fasterxml.jackson.databind.ObjectMapper { | |
public <methods>; | |
protected <methods>; | |
} | |
-keep class com.fasterxml.jackson.databind.ObjectWriter { | |
public ** writeValueAsString(**); | |
} | |
-keepnames class com.fasterxml.jackson.** { *; } | |
-dontwarn com.fasterxml.jackson.databind.** | |
-dontwarn okhttp3.internal.platform.* | |
-keep class com.fasterxml.jackson.databind.ObjectMapper { | |
public <methods>; | |
protected <methods>; | |
} | |
-keep class com.fasterxml.jackson.databind.ObjectWriter { | |
public ** writeValueAsString(**); | |
} | |
-dontwarn android.support.design.internal.** | |
-dontwarn com.google.android.gms.** | |
-dontwarn android.support.v4.** | |
-keepclassmembers class * implements android.arch.lifecycle.LifecycleObserver { | |
<init>(...); | |
} | |
-keepclassmembers class * extends android.arch.lifecycle.ViewModel { | |
<init>(...); | |
} | |
-keepclassmembers class android.arch.lifecycle.Lifecycle$State { *; } | |
-keepclassmembers class android.arch.lifecycle.Lifecycle$Event { *; } | |
-keepclassmembers class * { | |
@android.arch.lifecycle.OnLifecycleEvent *; | |
} | |
-keep class * implements android.arch.lifecycle.LifecycleObserver { | |
<init>(...); | |
} | |
-keep class kotlin.Metadata { *; } | |
-keepclassmembers public class com.mypackage.** { | |
public synthetic <methods>; | |
} | |
-keepclassmembers class kotlin.Metadata { | |
public <methods>; | |
} | |
-keep class kotlin.** { *; } | |
-keep class kotlin.Metadata { *; } | |
-dontwarn kotlin.** | |
-keepclassmembers class **$WhenMappings { | |
<fields>; | |
} | |
-keepclassmembers class kotlin.Metadata { | |
public <methods>; | |
} | |
-assumenosideeffects class kotlin.jvm.internal.Intrinsics { | |
static void checkParameterIsNotNull(java.lang.Object, java.lang.String); | |
} | |
### Android Architecture Components | |
# Ref: https://issuetracker.google.com/issues/62113696 | |
# LifecycleObserver's empty constructor is considered to be unused by proguard | |
#-keepclassmembers class * implements android.arch.lifecycle.LifecycleObserver { | |
# <init>(...); | |
#} | |
-keep class * implements android.arch.lifecycle.LifecycleObserver { | |
<init>(...); | |
} | |
# ViewModel's empty constructor is considered to be unused by proguard | |
-keepclassmembers class * extends android.arch.lifecycle.ViewModel { | |
<init>(...); | |
} | |
# keep Lifecycle State and Event enums values | |
-keepclassmembers class android.arch.lifecycle.Lifecycle$State { *; } | |
-keepclassmembers class android.arch.lifecycle.Lifecycle$Event { *; } | |
# keep methods annotated with @OnLifecycleEvent even if they seem to be unused | |
# (Mostly for LiveData.LifecycleBoundObserver.onStateChange(), but who knows) | |
-keepclassmembers class * { | |
@android.arch.lifecycle.OnLifecycleEvent *; | |
} | |
# Jackson mapper in kotlin | |
-keep @com.fasterxml.jackson.annotation.JsonIgnoreProperties class * { *; } | |
-keep class com.fasterxml.** { *; } | |
-keep class org.codehaus.** { *; } | |
-keepnames class com.fasterxml.jackson.** { *; } | |
-keepclassmembers public final enum com.fasterxml.jackson.annotation.JsonAutoDetect$Visibility { | |
public static final com.fasterxml.jackson.annotation.JsonAutoDetect$Visibility *; | |
} | |
# General | |
-keepattributes SourceFile,LineNumberTable,*Annotation*,EnclosingMethod,Signature,Exceptions,InnerClasses | |
#webview and java script | |
-keep public class android.net.http.SslError | |
-keep public class android.webkit.WebViewClient | |
-dontwarn android.webkit.WebView | |
-dontwarn android.net.http.SslError | |
-dontwarn android.webkit.WebViewClient | |
-dontwarn | |
-keepattributes Signature | |
-keepattributes SetJavaScriptEnabled | |
-keepattributes JavascriptInterface | |
-keepattributes InlinedApi | |
-keepattributes SourceFile,LineNumberTable | |
-keepattributes *Annotation* | |
-keepclassmembers class * { | |
@android.webkit.JavascriptInterface <methods>; | |
} | |
-keepclassmembers class * { | |
@android.webkit.JavascriptInterface <methods>; | |
} | |
-keepclassmembers class **.*$MyJavascriptInterface { | |
*; | |
} | |
-keepclassmembers class **.*$JavaScriptInterface { | |
*; | |
} | |
-keep public class **.*$MyJavascriptInteface | |
-keep public class **.*$JavaScriptInterface | |
-keepclassmembers class * { | |
@android.webkit.JavascriptInterface <methods>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment