java.lang.IllegalStateException:
I am using your live data adapter but I got error in observer callback, please look at the issue.
java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
This is not related to the library itself it's a parse error.
Your response is expecting a object while the real response is returning an array.
I think this api is not compatible with json array response , if it is compatible with json array response ,please give the some live of code , for your kind information i am using as:
@GET("marvel") LiveData<Resource<List<Hero>>> getHeroesLiveDataList(); i think its expecting the object and the response is json array. My question is how to deal with response of json array in case of LiveData by adding the LiveDataFactory in Retrofit library.
I can try on the weekend.
It was expecting object because you did
GET("marvel") LiveData<Resource<List>> getHeroesLiveDataList();
Instead, try
GET("marvel") LiveData<Resource<List<Hero>>> getHeroesLiveDataList();
List is an object, while List<Hero> is an array
Assuming Hero is your model class.
I have the same error and I can´t figure out what is the error. I tried with LiveDataCallAdapter from google examples and get the same error. But If I try with Call object its works.
UPDATE: Never mind. It was my error. It is working now