Android Question

Retrofit 2 beta-4. Android 6. Unable to create convertor

How to fix it?

Process:, PID: 2047
java.lang.IllegalArgumentException: Unable to create converter for class
for method APIWebService.getServices
at retrofit2.Utils.methodError(
at retrofit2.MethodHandler.createResponseConverter(
at retrofit2.MethodHandler.create(
at retrofit2.Retrofit.loadMethodHandler(
at retrofit2.Retrofit$1.invoke(
at java.lang.reflect.Proxy.invoke(
at $Proxy2.getServices(Unknown Source)

I use com.squareup.retrofit2:retrofit:2.0.0-beta4 and com.squareup.retrofit2:converter-gson:2.0.0-beta4


Retrofit retrofit = new Retrofit.Builder()


Call<ServiceResponse> getServices(@Query("city") String cityId);

Answer Source

You have to specify a Converter for the class ServiceResponse in order for gson to serialize/deserialize your class effectively it would go like this

GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(ServiceResponse.class, new ServiceResponseJson());
Gson gson =;

later on, you ll have to provide this gson instance to your gson converter factory like this


ServiceResponseJson will have to implement JsonDeserializer and/or JsonSerializer

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download