Unable to create call adapter for io.reactivex.Observable

前端 未结 3 780
别那么骄傲
别那么骄傲 2020-12-25 09:12

I\'m going to send a simple get method to my server(it is Rails app) and get the result using RxJava and Retrofit. The thing that I did is:

My interface:



        
3条回答
  •  执念已碎
    2020-12-25 09:47

    You need to tell Retrofit that you want to use RxJava 2, using:

    addCallAdapterFactory(RxJava2CallAdapterFactory.create())
    

    So, for creating your Retrofit object, you will have something like:

    Retrofit retrofit = new Retrofit.Builder()
        .baseUrl(SERVICE_ENDPOINT)
        .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
        .build();
    

提交回复
热议问题