简体   繁体   English

Android 工作室错误:要使用 RxJava2 功能,您必须从 Room 添加“rxjava2”工件作为依赖项

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

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以下是我在 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!!!❤️提前致谢!!!❤️

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)到您的 build.gradle(用于您的应用程序或模块)

( source ) 来源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM