Search code examples
javaandroidgson

java.lang.RuntimeException: Missing type parameter


My project encountered this error:

enter image description here

I tried to fix it using this link

but I can not because I do not really understand the answer. Please tell me how to fix it. Thanks


Solution

  • The class TypeToken requires a type parameter.

    Looking at your code, it looks like you should replace

    Type listType = new TypeToken() {
    }.getType();
    

    with

    Type listType = new TypeToken<List<Face>>() {
    }.getType();