Using Retrofit getting error onFailure: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: closed

后端 未结 1 1987
闹比i
闹比i 2021-02-09 14:51

I am getting error while adding OkHttpClient object into retrofit.

Error is: com.google.gson.JsonSyntaxException: java.lang.IllegalStat

相关标签:
1条回答
  • 2021-02-09 15:11

    Note that Retrofit 2 relies on OkHttp for its network operations Hence you will not need to add OkHttp dependency explicitly once you have added the retrofit2. I believe that could be causing the version conflict.

    Edit: Use beta 3 for both retrofit and gson

    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
    compile 'com.squareup.retrofit2:retrofit-converters:2.0.0-beta3'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3
    
    0 讨论(0)
提交回复
热议问题