Я использую модификацию 2 и rxjava 2 в моем приложении. Вот мои реализации Gradle:
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.4.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
Это мой класс соединения API:
public class ApiConnection {
private static String BaseUrl = "http://mysites.com/";
private static Retrofit retrofit = null;
public static Retrofit getClient() {
Gson gson = new GsonBuilder()
.setLenient()
.create();
if (retrofit == null) {
retrofit = new Retrofit.Builder()
.baseUrl(BaseUrl)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
}
return retrofit;
}
}
Я получил ошибку в этой строке:
RxJava2CallAdapterFactory
Это ошибка:
Cannot resolve symbol 'RxJava2CallAdapterFactory
Что не так с моим кодом?