Error: incompatible types: GsonConverterFactory could not be converted to Factory

I am trying to use Retrofit 2.0.0.beta2 when setting up the converter for Gson, as below

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

After this error gradle throwing

GsonConverterFactory cannot be converted to Factory

How to fix it???

+6
source share
2 answers

you are probably the first beta of GsonConverterFactory with the second beta of Retrofit . Make sure you have

 compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2' 

in gradle

+11
source

I have a problem...

I used compile 'com.squareup.retrofit: converter-gson: 2.0.0-beta1' instead of 'com.squareup.retrofit: converter-gson: 2.0.0-beta2'

 dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.squareup.retrofit:retrofit:2.0.0-beta2' compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2' compile 'com.google.code.gson:gson:2.3'} 
+2
source

All Articles