Can\'t figure out why is this happening. Neither one of rx callbacks (onCompleted(), onError(), onNext()) not gets triggered by my call. The only thing i receive is this okh
Thanks to @Kiskae. This gave me the correct hint. In my case I used a CompositeSubscription and added a subscription to it after it was unsubscribed by another method.
/**
* Adds a new {@link Subscription} to this {@code CompositeSubscription} if the
* {@code CompositeSubscription} is not yet unsubscribed. If the {@code CompositeSubscription} <em>is</em>
* unsubscribed, {@code add} will indicate this by explicitly unsubscribing the new {@code Subscription} as
* well.
*
* @param s
* the {@link Subscription} to add
*/
I had the same problem but in my case when two requests subscribed in the same CompositeDisposable
one of them gets cancelled. I mean those 2 requests are done in parallel.
That exception gets thrown if the request is cancelled by the user. When using RxJavaCallAdapterFactory
this happens if the subscription is unsubscribed before the call can complete. So I guess at some point after you do the call you do subscription.unsubscribe()
which cancels the underlying requests.
What helped to me is to replace deprecated call adapter:
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
with:
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
This helped me with this issue and I get onError() called every time. More info on this: https://github.com/JakeWharton/retrofit2-rxjava2-adapter