retrofit convertor factory can not access GsonConverterFactory

前端 未结 5 1555
情话喂你
情话喂你 2020-12-08 18:38

I have included these dependencies to my project:

compile \'com.squareup.retrofit:retrofit:2.0.0-beta2\'
compile \'com.squareup.retrofit:convert

5条回答
  •  悲&欢浪女
    2020-12-08 18:55

      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.

提交回复
热议问题