I have included these dependencies to my project:
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
I have a class where I am going to access my api's via retrofit:
public static <S> S createService(Class<S> serviceClass, String baseUrl) {
Retrofit builder = new Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create())
.build();
RestAdapter adapter = builder.build();*/
return builder.create(serviceClass);
}
And now, it gives me this compile time error :
Error:(24, 17) 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
How can I solve this? I followed the documentation. What is wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…