How to fix Expected BEGIN_OBJECT in Retrofit?

后端 未结 1 341
-上瘾入骨i
-上瘾入骨i 2021-01-23 22:19

In my application i want use Retrofit for get some data from server.
I write below codes but when run application and call api show me below error :

相关标签:
1条回答
  • 2021-01-23 23:11

    You need to add a gsonconverter factory before building your api service interface.

    Retrofit retrofit = new Retrofit.Builder()
        .baseUrl(BASE_URL)
        .addConverterFactory(GsonConverterFactory.create())
        .build();
    
    retrofit.create(apiservice.class)
    
    0 讨论(0)
提交回复
热议问题