I want to convert a class which contains a Hashmap of non-primitive keys or values to Json using Gson. so I realize that Hashmap keys and values are stored only as Strings when serializing with Gson. so I can’t serialize them. I ran into this solution which should be fine, but I get this error: any idea? EDIT: this is