orhanobut / hawk

✔️ Secure, simple key-value storage for Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hawk crashed if put Enum

wa1demar opened this issue · comments

Please try to fill all questions below before submitting an issue.

  • On which android versions do you have this issue? : 8.1
  • On which phones do you have this issue? : Google Pixel 2
  • Which hawk version are you using? : 2.0.1
  • Does this issue happen always or is it flaky? : always

Here is my enum

public enum OrderStatus {
    UNDEFINED(null), PENDING("Pending"), RECEIVED("Received"), SHIPPED("Shipped"), CANCELLED("Cancelled"), REFUNED("Refunded");
    private String mLocalizedValue;

    OrderStatus(String localizedValue) {
        mLocalizedValue = localizedValue;
    }

    public String getLocalizedValue() {
        return mLocalizedValue;
    }
}

And here is my error

java.lang.NoSuchFieldException: UNDEFINED

Here is my solution

-keepclassmembers enum * { *; }

mark