Skip to content

Instantly share code, notes, and snippets.

@thoinv
Last active May 13, 2021 08:40
Show Gist options
  • Save thoinv/a15c3440e38590e0c0871546357ddf5a to your computer and use it in GitHub Desktop.
Save thoinv/a15c3440e38590e0c0871546357ddf5a to your computer and use it in GitHub Desktop.
[Proguard Template] #apkprotect #android
-repackageclasses ''
#Optimization Option
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
-optimizationpasses 5
#Annotation
-keepattributes *Annotation*
-keep @interface com.google.gson.annotations.*
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-keepattributes Exceptions, InnerClasses
#JNI
-keepclasseswithmembernames class * {
native <methods>;
}
-dontwarn javax.annotation.**
# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*
# OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.ConscryptPlatform
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
#
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
######################### Google Play Services specific rules ##########################
-keepattributes Signature
-keepattributes MethodParameters
-keepattributes *Annotation*
-keep class sun.misc.Unsafe { *; }
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-dontwarn android.webkit.JavascriptInterface
-dontnote org.apache.http.**
-dontnote android.net.http.**
# PROGUARD FIREBASE
# Keep SafeParcelable value, needed for reflection. This is required to support backwards
# compatibility of some classes.
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
# Needed for Parcelable/SafeParcelable classes & their creators to not get renamed, as they are
# found via reflection.
-keepnames class * implements android.os.Parcelable
-keepclassmembers class * implements android.os.Parcelable {
public static final *** CREATOR;
}
## Keep the classes/members we need for client functionality.
#-keep @interface android.support.annotation.Keep
#-keep @android.support.annotation.Keep class *
#-keepclasseswithmembers class * {
# @android.support.annotation.Keep <fields>;
#}
#-keepclasseswithmembers class * {
# @android.support.annotation.Keep <methods>;
#}
# Keep the names of classes/members we need for client functionality.
-keep @interface com.google.android.gms.common.annotation.KeepName
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-dontwarn com.android.installreferrer.api.**
# OkHttp
-keepattributes Signature
-keepattributes *Annotation*
# Needed when building against pre-Marshmallow SDK.
-dontwarn android.security.NetworkSecurityPolicy
# Needed when building against Marshmallow SDK.
#-dontwarn android.app.Notification
#for js and webview interface
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
#Glide
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep class * extends com.bumptech.glide.module.AppGlideModule {
<init>(...);
}
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
*** rewind();
}
#eventbus
-keepattributes *Annotation*
-keepclassmembers class * {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
<init>(java.lang.Throwable);
}
#crashlytics
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
#GGDrive
-keep interface com.google.** { *; }
-keep class com.google.** { *;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment