(Retrofit) Could not locate converter for class crashing app (Retrofit) Could not locate converter for class crashing app java java

(Retrofit) Could not locate converter for class crashing app


I was facing the same issue. I fixed it by adding :

compile 'com.squareup.retrofit2:converter-gson:<latest-version>'

to my build.gradle

Then specify the converter when creating my Retrofit instance.

Retrofit retrofit = new Retrofit.Builder()            .baseUrl(Constants.API_BASE_URL)            .addConverterFactory(GsonConverterFactory.create())            .build();


In Retrofit 2.0, Converter is not included in the package and when you are using Retrofit 2.0 Make Sure follow new URL pattern

Base URL: always ends with /

@Url: DO NOT start with /

Retrofit retrofit = new Retrofit.Builder()        .baseUrl(Constants.API_BASE_URL)        .addConverterFactory(GsonConverterFactory.create())        .build();

For more information about 2.0 Follow this link Retrofit 2.0: The biggest update

And also update build.gradle.

implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"

And add the extension in project level build.gradle file

ext {retrofit_version= "2.x.x"}


Change retrofit version accordingly

For me below dependency was there already

compile 'com.squareup.retrofit2:retrofit:2.0.2'

For gson 2.0.2 I changed

compile 'com.squareup.retrofit2:converter-gson:2.0.2'

Then add

Retrofit retrofit = new Retrofit.Builder()            .baseUrl(Constants.API_BASE_URL)            .addConverterFactory(GsonConverterFactory.create())            .build();