orhanobut / hawk

✔️ Secure, simple key-value storage for Android
Apache License 2.0
3.98k stars 388 forks source link

Hawk V2.0.1, illegal type variable reference #234

Open abdullahjhussein opened 5 years ago

abdullahjhussein commented 5 years ago

java.lang.AssertionError: illegal type variable reference at libcore.reflect.TypeVariableImpl.resolve(TypeVariableImpl.java:111) at libcore.reflect.TypeVariableImpl.getGenericDeclaration(TypeVariableImpl.java:125) at libcore.reflect.TypeVariableImpl.hashCode(TypeVariableImpl.java:47) at java.util.Arrays.hashCode(Arrays.java:4074) at com.google.gson.internal.$Gson$Types$ParameterizedTypeImpl.hashCode(SourceFile:1) at com.google.gson.reflect.TypeToken.(SourceFile:4)

I had this crash in release mode, when try to put ArrayList of object in hawk. Also, i add Progaurd rules related Hawk lib

we use Hawk: V2.0.1 Gson: V2.8.5

alexeygron commented 5 years ago

decision https://github.com/orhanobut/hawk/issues/195#issuecomment-455837851

lemberh commented 5 years ago

I had the same issue, this Proguard rule had fixed my problem -keep class com.orhanobut.hawk.** { *; } I was getting custom objects map from Hawk

Hawk.get<MutableMap<String, Request>>(REQUESTS_KEY) //<-- CRASH HERE

@Keep
internal data class Request(
    val objId: String,
    val objectClass: UploadClass,
    val extra: Map<String, String> = emptyMap()
)

@Keep
internal enum class UploadClass {
    TYPE_ONE, TYPE_TWO
}
mezhevikin commented 4 years ago

@lemberh You saved my day. thk

ahan530 commented 3 years ago

thanks