I am using RxJava3 with Room in my project but I am getting the following error
error: Not sure how to convert a Cursor to this method's return type (io.reactivex.rxjava3.core.Flowable>)
Below is DAO interface method on which I am getting the error
@Query("SELECT * FROM wishlist_table")
Flowable<List<WishListMovie>> getWishList();
I think maybe its because I am using the dependency below in my grade file:
implementation "androidx.room:room-rxjava2:$room_version"
I tried to find the above dependency for RxJava 3 but I was unable to find it.
I want to know how can I use RxJava 3 with Room or should I use RxJava 2 instead in my project.
July 22, 2020
In Room 2.3.0-alpha02 was added support for RxJava3 types. Though it's still in alpha, but you can consider this option.
According to release description:
Similar to RxJava2 you can declare DAO methods whose return type are Flowable, Single, Maybe and Completable.
Additionally a new artifactandroidx.room:room-rxjava3
is available to support RxJava3
I want to know how can I use RxJava 3 with Room or should I use RxJava 2 instead in my project.
You can not use RxJava3 with Room "room-rxjava2" dependency.
RxJava2 and RxJava3 are different. In order to avoid runtime errors (e.g. during linking) RxJava3 chose different packages. This is why the returned type does not match (different package)
Until there is a room-rxjava3 package you have to use RxJava2 as a dependency.
You could checkout room-rxjava2 and change all packages for rxjava3 and compile aginst rxjava3 and then use this package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With