I have included these dependencies to my project:
compile \'com.squareup.retrofit:retrofit:2.0.0-beta2\'
compile \'com.squareup.retrofit:convert
With latest Beta 2.0.3 release you need to add :
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3'
Make sure to match the retrofit library version with gson converter version.
Try to use same version for retrofit and converter-gson - 2.0.0-beta2. You are using beta2 for retrofit and beta1 for converter.
implementation 'com.squareup.retrofit:retrofit:2.0.0-beta2'
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
Important note!
Retrofit change its package name since 2.0.0-beta3 version. Now you should use com.squareup.retrofit2. Here is example:
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
error: method addConverterFactory in class Builder cannot be applied to given types;
required: Factory
found: GsonConverterFactory
reason: actual argument GsonConverterFactory cannot be converted to Factory by method invocation conversion
If you are getting this error, The reason is wrong dependancy included.
Add/ change dependency in application build.gradle file as
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
make sure that converter version is 2.0.0-beta2 not 2.0.0-beta1.
In build.gradle (app) instead of:
implementation 'com.google.code.gson:gson:2.8.2'
write:
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
This is the latest:
compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0'
If you use beta version:
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'