Hawk ProGuard rules

Hawk – is a secure and simple key-value storage for Android.

ProGuard rules for Hawk

ProGuard optimizes the your program code and and removes unused classes, fields and and attributes. After ProGuard shrinks and obfuscates code, short names like 'a', 'b', etc. are used as obfuscated names. To fix errors use the following rules in proguard-rules.pro file.

# Gson

# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# https://github.com/orhanobut/hawk/issues/143
-keepattributes EnclosingMethod

# Gson specific classes
-keep class sun.misc.Unsafe { *; }

# Facebook Conceal

# Keep our interfaces so they can be used by other ProGuard rules.
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.crypto.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.crypto.proguard.annotations.KeepGettersAndSetters

# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.crypto.proguard.annotations.DoNotStrip class *
-keepclassmembers class * {
    @com.facebook.crypto.proguard.annotations.DoNotStrip *;
}

-keepclassmembers @com.facebook.crypto.proguard.annotations.KeepGettersAndSetters class * {
  void set*(***);
  *** get*();
}

For more information about please see Hawk website.

Related ProGuard rules

Static Gson ProGuard rules

Popular ProGuard rules