Skip to content Skip to sidebar Skip to footer

Android Retrofit Get Request Conversionexception Issue

I'm using Retrofit to make REST requests and create the corresponding model objects (with gson using the @SerializedName annotation). There is one particular GET request that occa

Solution 1:

1) Why are these conversion exceptions occurring, when as far as I can tell, the response data is always correct?

You expected data that looks like this:

{"foo":"bar"}

But Gson found something more like:

Hello!

It was expecting a JSON object beginning (aka the { character) but it found a string-like character instead.

2) Does retrofit do any sort of caching for GET requests? This might explain why re-requesting a failed request continues to fail until I kill and restart the application.

Retrofit has no caching whatsoever.

Depending on what HTTP client you are using, it may cache the response of a GET request depending on the headers. Usually you have to opt-in to cache behavior in an HTTP client so if you haven't done that, I doubt it's enabled.

Post a Comment for "Android Retrofit Get Request Conversionexception Issue"