Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

ERRO API GSON

Galera, apresenta um erro quando tento rodar o Gson. Alguém sabe o que pode estar gerando?

Insira aqui a descrição dessa imagem para ajudar na acessibilidade

Digite um filme para busca: matrix {"Title":"Matrix","Year":"1993","Rated":"N/A","Released":"01 Mar 1993","Runtime":"60 min","Genre":"Action, Drama, Fantasy","Director":"N/A","Writer":"Grenville Case","Actors":"Nick Mancuso, Phillip Jarrett, Carrie-Anne Moss","Plot":"Steven Matrix is one of the underworld's foremost hitmen until his luck runs out, and someone puts a contract out on him. Shot in the forehead by a .22 pistol, Matrix "dies" and finds himself in "The City In Between", where he is ...","Language":"English","Country":"Canada","Awards":"1 win","Poster":"https://m.media-amazon.com/images/M/MV5BYzUzOTA5ZTMtMTdlZS00MmQ5LWFmNjEtMjE5MTczN2RjNjE3XkEyXkFqcGdeQXVyNTc2ODIyMzY@._V1_SX300.jpg","Ratings":[{"Source":"Internet Movie Database","Value":"7.8/10"}],"Metascore":"N/A","imdbRating":"7.8","imdbVotes":"208","imdbID":"tt0106062","Type":"series","totalSeasons":"N/A","Response":"True"} Exception in thread "main" com.google.gson.JsonIOException: Abstract classes can't be instantiated! Register an InstanceCreator or a TypeAdapter for this type. Class name: br.com.alura.screenmatch.modelos.Titulo at com.google.gson.internal.ConstructorConstructor$3.construct(ConstructorConstructor.java:136) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.createAccumulator(ReflectiveTypeAdapterFactory.java:427) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:383) at com.google.gson.Gson.fromJson(Gson.java:1227) at com.google.gson.Gson.fromJson(Gson.java:1137) at com.google.gson.Gson.fromJson(Gson.java:1047) at com.google.gson.Gson.fromJson(Gson.java:982) at br.com.alura.screenmatch.Principal.PrincipalComBusca.main(PrincipalComBusca.java:37)

1 resposta
solução!

descobri aqui, é que coloquei a classe Titulo como abstract, por isso não foi.