Android studio Error: To use RxJava2 features, you must add `rxjava2` artifact from Room as a dependency

Issue

I have facing the following error while building the project. And unable to solve the same after trying it for whole day.

error: To use RxJava2 features, you must add `rxjava2` artifact from Room as a dependency. androidx.room:room-rxjava2:<version>
    public abstract java.lang.Object clearAllBillers(@org.jetbrains.annotations.NotNull()
                                     ^

below are my dependancies inside the build.gradle

implementation("androidx.room:room-rxjava2:2.3.0")

implementation "androidx.room:room-runtime:2.3.0"
implementation "androidx.room:room-ktx:2.3.0"
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
kapt "androidx.room:room-compiler:2.3.0"

I have done trying already existing solutions such as upgrading

classpath 'com.android.tools.build:gradle:7.3.1'

Also tried to do invalidate cache and clean project.
Still not able to solve the issue.

Please help me if you have any idea to get it resolve.
Thanks in advance!!!❤️

Solution

Not sure why haven’t you received an answer quicker (because this question has an easy solution)
you just need to add

implementation("androidx.room:room-rxjava2:2.4.3")

to your build.gradle (for your app or module)

(source)

Answered By – JustSightseeing

Answer Checked By – Jay B. (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *